home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / THINK C Digest / 1992 / 92-05 < prev    next >
Text File  |  1995-12-31  |  144KB  |  4,214 lines

  1. 
  2. Path: ucivax!gateway
  3. From: leone@ohsu.edu (TJ Leone)
  4. Subject: Apple Event Object Support Library
  5. Message-ID: <9205011830.AA22357@rainier.ohsu.edu>
  6. Newsgroups: fa.think-c
  7. Lines: 2
  8. Date: 1 May 92 20:38:34 GMT
  9.  
  10. Anybody know of an ftp site that has the Apple Event Object Support Library Developer
  11. Notes?
  12. 
  13. 
  14. Path: ucivax!gateway
  15. From: halifax%admiral.UUCP@cs.yale.edu
  16. Subject: (none)
  17. Message-ID: <9205022227.aa10832@admiral.uucp>
  18. X-Mailer: SCO System V Mail (version 3.2)
  19. Newsgroups: fa.think-c
  20. Lines: 35
  21. Date: 3 May 92 03:15:15 GMT
  22.  
  23. From halifax  Sat, 02 May 92 22:27:23 EDT
  24. To: think-c@ics.uci.edu
  25. Subject: HELP!!! My program died!!
  26. From: admiral.uucp!halifax@uunet.uu.net (Nathan Neulinger)
  27. Message-ID: <ccF7JB3w164w@admiral.uucp>
  28. Date: Sat, 02 May 92 22:27:23 EDT
  29. Organization: The Grid/Waffle BBS, 203-661-2873, -1279, -0450, -2967
  30.  
  31. I don't know what I did to it... but it just plain don't work no more!
  32.  
  33. Te program I am referring to is a Fractal Image Genertor that I am
  34. working on... It was working GREAT for a while... I even got it to print
  35. out in full color... but now it doesn't work... I am getting alot of Odd
  36. Address errors... and also illegal instruction errors... it's weird... I
  37. cannot seem to find what the problem is...
  38.  
  39. I don't use alot of handles, so I doubt that it would be a problem with
  40. them... I also give the program plenty of memory, 800K segment... and my
  41. code segments are small... does anyone have any idea what might be
  42. causing it... PLEASE email me if you have any suggestions as to how I
  43. might alleviate this dreadful problem - I need this program to work for
  44. my final project for my Advanced C Programming class....
  45.  
  46. BTW - I am using Think C 5.0 under 7.0 on a MacPlus with 4MB....
  47.  
  48. Nathan Neulinger
  49. admiral!halifax@uunet.uu.net
  50.  
  51. Thanks Alot"!!!
  52.  
  53. --
  54. admiral!halifax@uunet.uu.net (Nathan Neulinger) <uunet!admiral!halifax>
  55. The Admiral's Public UNIX - Greenwich, CT - System Administrator: Doug Fields
  56. (HST/V32) (203)661-2873 -- (PEP/V32) -1279 -- (V32) -0450 -- (V29/MNP6) -2967
  57. >FREE!< Unix shell accounts, Usenet access, and Internet-style mail available
  58. 
  59. 
  60. Path: ucivax!gateway
  61. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  62. Subject: (none)
  63. Message-ID: <9205031018.AA22887@andy.bgsu.edu>
  64. Newsgroups: fa.think-c
  65. Lines: 21
  66. Date: 3 May 92 10:18:19 GMT
  67.  
  68.  
  69.     In my application, I am using the CommToolBox to handle all of the
  70. communications needed in my program.  I have the code put in correctly, but
  71. the part that does not mesh is how the three types of managers work together.
  72. Specifically the connection manager with the terminal manager.
  73.  
  74.     If the connection manager sees some data coming in, how does it let
  75. me (or the terminal manager) know that there is some data to be displayed on
  76. the terminal manager's window?
  77.  
  78.     My idle procedure is in place, and I have seen the connection manager
  79. routines to read and write data.  But from what I can tell, there is not
  80. a way for the connection manager to say "Hey, Dude! Got some narley bits for
  81. you coming in off of the serial port..."
  82.  
  83.     What am I missing?
  84.  
  85.  
  86.     Let me know if you know, I would appreciate it...
  87.  
  88.     dnebing@andy.bgsu.edu
  89. 
  90. 
  91. Path: ucivax!gateway
  92. From: HBZ@zabin.rz-berlin.mpg.de (Hal Zabin)
  93. Subject: FSRead into a structure...
  94. Message-ID: <9205031228.aa11251@q2.ics.uci.edu>
  95. X-Mailer: LeeMail 1.2
  96. Newsgroups: fa.think-c
  97. Lines: 48
  98. Date: 3 May 92 19:28:59 GMT
  99.  
  100.  
  101. Please respond to: ZABIN@RZ-BERLIN.MPG.DE
  102.  
  103. <=====-------------------------------=====>
  104. Dr. Hal B. Zabin
  105. Max-Planck-Institut fr molekulare Genetik
  106. Abteilung Trautner
  107. 1000 Berlin 33
  108. Germany
  109. <=====-------------------------------=====>
  110.  
  111. (This file must be converted with BinHex 4.0)
  112.  
  113. :#P4)58j,,QKPE(!!9%9B9(4dH(3!!!!!"JF!!!!!DI&8D'8JCQpXE'phD@jR)'0
  114. [C'8JBfpZG'&TER-JB5"LG@FJD@iJFQ9KC'PZCb"K)(4PH(3JCQPXC5"TER4[)'%
  115. JBfKKFQ&MG'9b$@*eCQCPFL!SGfKTBfJJDA-JF'&bG#"[CL"K)(0dFR9MG(9bC5N
  116. Z)&4SC5"LG@FJDA-JC'9cBh*TBQ9N)'&d)(4SC5"PEQ3JEfB0G'KP)'0[C'8JFf9
  117. RE@9ZG#iJ55"hEh9XC#"KF("bC@0TBA4P)'&ZH5"TC'9KFb"KERP[EQ8JE@&j)'K
  118. KGQ8JEfiJGfKKG!e*)'&Y)'4[D@jR)(GbEfjR)'KPFQ8Z$3d0$@4PCQPZDA4TEfi
  119. JEfBJFh4bG@0dGA*P)'PZBfaeC'9N)'PZ)("bEfGbB@dYGfPNC5"SC@&NCA)JCQP
  120. XC6S0$A0dFR9MG#"$8h4eCQCl$3PMD'&b)#TdD'96G()l#5mU)'0SBA*KBh4PFL"
  121. LG@CQCA)J+Lm0#@a[EQF*G'KP6'9ZCh4S1`N[+L"MGA*bC@jd)'aPEQGdD#"[CL"
  122. dD'96G()J+Lm0#@a[EQF*B90THQ8l#5mU)'pbD@GTEQ&X)'&XE'pMBA4TEfiJFfP
  123. kC5"[CL"dD'96G()J+Lm0I6X0)f4PCQPZC5"$D'&b8h4eCQB*Fh4bG@0d)%06G(9
  124. QCJedHA"PC'9Q)%0SBA*6G(9QCJNU3e03G()l$A4jF'9NC@BJ3e03G()*+N065'&
  125. ZC'aP1`d0$@*KFf96CA%JDA-JC'9ME'&bC@3JBA-JB5"RE'pLB@`J3e03G()JD@i
  126. JB@iJD@jME(9NC@3JCQPXC6S03e03G()*EQ9h8f9a,'*KFf96CA%XB@aTCfj8H(3
  127. l$3d08'&bG#"[CL!LCQPXC5jM)L"hD'PMD#"cD'peE'3JFQ9KC#"K)(4PH(3JCQP
  128. XC5"K)("eG#"dD'8JG'9iG#"TER4[$@*KFf96CA%Y2R4SC90dFL!SF'&bG#"[CL"
  129. KBQpfC5"cG(*eBh4eFQ8T1Jd0E'pZCb"5C@&N5@j'D@aP+(C[D@3T$AX0#@a[EQF
  130. JBfpeER3XG'KP6'9ZCh4S1`d*D@jd)&4SC8PZ8Q9Q1`d*$3PTCL!S4P02F'9Z+(4
  131. SC9*PF'aj,QC1B@eP,(4SC9*PF'aj,RC5C@C1G@dX*P4SC8PZ8Q9Q+5N0#3P%Ede
  132. PFh0KCf8S)Pa`4A*bEh)JEh"PEQPZCb"QD@aP)LNl$3P(CA4&6dBS9'KP5@j5C@B
  133. X*R4SC8aPEQGdD#Nl#5mU)'GPG#"XC@jRG'JJ+Lm0$3PMEh9ZG$edD'9-C@jRG'J
  134. l$3d*,bSJB@aXEf0KG'8JE@9YEh*j)#S[$3PLBA0P8f9a,6jK8fPkC6dSG'KP6'9
  135. ZCh4S+5TcDATPEfBSBfKKFLNl$3PLBA0P8f9a,6jdD'96G()J25!SBfKKFLST6Q9
  136. h8(4b+'*KFf96CA%Y2Q&6DATP+6X*$3PTCL!S6@9Y4A*bEh)S+5N*4'p0CA0cB@G
  137. P+#*FF%9bFQpb)'PZ)'&XE'pMBA4TEQFJBQ&cC90PF5dqG'KP8h4b)LNl$3N0#5m
  138. U+LSU+L"38Np#6%90)%a*6N8J4Np-6%pA8b%K)5%K)5%K)#SU+LSU+LSU+LSU+LS
  139. U+LSU+LS[$3PTCL!S4P05C@&N+&4SC8PZ8Q9Q,#CMEh9ZG#aLBA0P8f9a,6jdD'9
  140. 6G()T+3d*$3N*4'p0CA0cB@GP+#*FF%9bFQpb)'PZ)(*PB@4TEQFJCQPXC5)T1`d
  141. *D@BJ+%C63fa[Ff8S9'KP5@j5C@BT+3d*#84[6@9cFf&RC5JLA("&FR*[FL"TEL"
  142. ME'pcD@jR)'CTE'8L+6X0$3eAD'9Z)%NJFR9Z)(4SDA-JF(*[Ch*KE5"dEb"dD'P
  143. c)("[D@jd,#"[EQaj)'G[BQ*XC@4j,@G[EfXJCfpPFb"TER4[)!eLBA0P8f9a,6j
  144. dD'96G()JBA3JG'KP)%C68Q9KC#"XD@jP,L""ERNJD@4PBA-r)&4SB@jVFb"K)'a
  145. [G#`0$8KKE#"#,L"DB@*TEJeD38**6N"5@Le#49*-58iZ69"(,N4&&QB!!!:
  146.  
  147.  
  148. 
  149. 
  150. Path: ucivax!gateway
  151. From: zabin@rz-berlin.mpg.de
  152. Subject: (none)
  153. Message-ID: <0095a0b1.945a7720.11198@RZ-Berlin.MPG.DE>
  154. Newsgroups: fa.think-c
  155. Lines: 59
  156. Date: 3 May 92 19:35:34 GMT
  157.  
  158. I just sent a version of this as an enclosure, and realize that it will
  159. probably be more trouble than it is worth to read it as sent. Therefore
  160. I am sending it again as a single text file. Sorry about the confusion!
  161.  
  162. The following code contains a bug in reading a text file into a character
  163. buffer (which is part of a structure). The bug is described at the end of
  164. the code segment. I would appreciate any ideas anyone may have on what
  165. I am doing wrong here.
  166.  
  167.  
  168.  
  169. definition of structure included in program-wide header file:
  170.  
  171. struct CStuff{
  172.     char *theStr;    /* character buffer */
  173.     long    theLength;    /* current length of theStr */
  174.     long    aSize;    /* original allocation size of theStr */
  175. };
  176. #define CharStuff    struct CStuff
  177. typedef CharStuff    *CSPtr;
  178. typedef CSPtr    *CSHandle;
  179.  
  180.  
  181. baseSeq is declared as a global CSPtr in an included file:
  182. CSPtr    newSeq,baseSeq,alignTxt;
  183.  
  184.  
  185. Part of "file.c" which should read a text file a put the text into
  186. baseSeq->theStr (part of above structure):
  187.  
  188. long ReadInFile(void)
  189. {
  190.     long count,theLength;
  191.     int TheInRef;
  192.  
  193.     if (FSOpen(theReply.fName,theReply.vRefNum,&TheInRef))
  194.         DoMessage("\pError opening file");
  195.     GetEOF(TheInRef,&theLength);    /* get length */
  196.  
  197.     count=theLength;
  198.  
  199.     /* allocate memory */
  200.     baseSeq->aSize=(theLength)*sizeof(char);
  201.     baseSeq->theStr = (char*)NewPtr(baseSeq->aSize);
  202.     if (MemError())    DoMessage("\pError in allocating baseSeq->theStr");
  203.  
  204.     /***** PROBLEM LINE FOLLOWS!!!!!!!! *******************/
  205.     if (FSRead(TheInRef,&count,baseSeq->theStr))
  206.  
  207.         DoMessage("\pError in reading file");
  208.     if (FSClose(TheInRef))
  209.         DoMessage("\pError in closing file");
  210.  
  211.  
  212. When I run this program to this point, only gobbledy-gook goes into
  213. baseSeq->theStr at the FSRead line. Any ideas? Thanks a lot,
  214.  
  215. Hal B. Zabin
  216. ZABIN@RZ-BERLIN.MPG.DE
  217. 
  218. 
  219. Path: ucivax!gateway
  220. From: BEASON@uno.cc.geneseo.edu (Bob Beason)
  221. Subject: Problem in SANE.h?
  222. Message-ID: <01GJLTVONJ6O0007O6@geneseo.bitnet>
  223. Newsgroups: fa.think-c
  224. X-VMS-To: IN%"think-c@ics.uci.edu"
  225. Lines: 9
  226. Date: 4 May 92 11:48:42 GMT
  227.  
  228. I was remaking ANSI-A4 last night to include FPU support.  After changing
  229. the line in ansi_config.h to commen out the nofloat statement, I tried to
  230. remake.  The following line in SANE.h kept producing a syntax error:
  231.     if sizeof(double) == 12
  232. I tried eveything I could think of, but nothing worked.  I am using
  233. THINK C 5.02 and System 7.  Does anyone have any ideas?
  234. Thanks in advance.
  235. Bob Beason
  236. beason@geneseo.bitnet
  237. 
  238. 
  239. Path: ucivax!gateway
  240. From: kkirksey@eng.auburn.edu ("Kenneth B. Kirksey")
  241. Subject: Profile Problem
  242. Full-Name: Kenneth B. Kirksey
  243. Message-ID: <9205041958.AA18373@eng.auburn.edu>
  244. Newsgroups: fa.think-c
  245. Lines: 11
  246. Date: 4 May 92 19:58:24 GMT
  247.  
  248.  
  249.     I was playing around with the profiler today and I had a strange
  250. problem. After i was finished profiling, I removed all the profile
  251. calls from my source and removed the Profile library from my project.
  252. When I tried to run the project again, it kept giving me link errors
  253. saying it couldn't find _proflie_. I tried removing the objects and
  254. rebuilding the project, but it still gave me the same error. It would
  255. only run if I included the profile library again. Anonyone have andy
  256. ideas why it would do this?
  257.  
  258.                              Ken
  259. 
  260. 
  261. Path: ucivax!gateway
  262. From: rsfinn@concerto.lcs.mit.edu ("Russell S. Finn")
  263. Subject: Re: Profile Problem
  264. Message-ID: <9205042117.AA10466@concerto.lcs.mit.edu>
  265. In-Reply-To: Your message of "04 May 92 19:58:24 GMT."
  266.              <9205041958.AA18373@eng.auburn.edu>
  267. Newsgroups: fa.think-c
  268. Lines: 17
  269. X-Mts: smtp
  270. Date: 4 May 92 21:18:23 GMT
  271.  
  272. >     I was playing around with the profiler today and I had a strange
  273. > problem. After i was finished profiling, I removed all the profile
  274. > calls from my source and removed the Profile library from my project.
  275. > When I tried to run the project again, it kept giving me link errors
  276. > saying it couldn't find _profile_. I tried removing the objects and
  277. > rebuilding the project, but it still gave me the same error. It would
  278. > only run if I included the profile library again. Anonyone have andy
  279. > ideas why it would do this?
  280.  
  281. Your project was compiled with the "Profiler" option on, which causes
  282. the compiler to insert calls to a function called "_profile_" at the
  283. beginning of each function in your code.  You'll need to turn this
  284. project option off again if you want to completely remove profiling
  285. from your program.
  286.  
  287. -- Russell S. Finn
  288. rsfinn@lcs.mit.edu
  289. 
  290. 
  291. Path: ucivax!gateway
  292. From: kkirksey@eng.auburn.edu ("Kenneth B. Kirksey")
  293. Subject: New Dialog Routines
  294. Full-Name: Kenneth B. Kirksey
  295. Message-ID: <9205042305.AA20265@eng.auburn.edu>
  296. Newsgroups: fa.think-c
  297. Lines: 47
  298. Date: 5 May 92 00:10:53 GMT
  299.  
  300.  
  301.     I'm having a little problem with the SetDialogTracksCursor function
  302. documented in Tech Note 304. Here's a chunk of my dialog handler:
  303.  
  304. +++++++++++++++++++++++++++++++++++++
  305. int HandleConvertDialog (void)
  306. {
  307.     int     itemHit,
  308.             dialogDone = FALSE;
  309.  
  310.     int     itemType;                   /* Vars for getting and setting       */
  311.     Rect    itemRect;                   /* dialog item values.                */
  312.     Handle  itemHandle;
  313.  
  314.     ModalFilterProcPtr  standardProc;
  315.  
  316.     /*-------------------------------------------------------------------------+
  317.     | Set Up The Dialog using those cool System 7 Dialog Routines.             |
  318.     +-------------------------------------------------------------------------*/
  319.     GetStdFilterProc(&standardProc);
  320.     SetDialogTracksCursor(gConvertDialog, FALSE );
  321.     SetDialogDefaultItem(gConvertDialog, rOkButton);
  322.     SetDialogCancelItem(gConvertDialog, rCancelButton);
  323.  
  324.     /*-------------------------------------------------------------------------+
  325.     | Show the dialog window.                                                  |
  326.     +-------------------------------------------------------------------------*/
  327.     ShowWindow (gConvertDialog);
  328.  
  329.     /*-------------------------------------------------------------------------+
  330.     | Dialog Event Loop.                                                       |
  331.     +-------------------------------------------------------------------------*/
  332.     while (dialogDone == FALSE)
  333.     {
  334.         ModalDialog (standardProc, &itemHit);
  335.         switch (itemHit)
  336.  
  337. +++++++++++++++++++++++++++++++++++++
  338.  
  339. Now the SetDialogDefaultItem and the SetDialogCancelItem functions work as
  340. advertised. No problem there. The SetDialogTracksCursor, however, doesn't.
  341. When I open my dialog and pass the pointer over one of the two edit text fields
  342. in the dialog, it doesn't change to the I-beam like it should. Anyone have
  343. any ideas why it's not working?  Many thanx in advance.
  344.  
  345.                                   Ken
  346.  
  347. 
  348. 
  349. Path: ucivax!gateway
  350. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  351. Subject: Keypress causes mac to beep, but no event is generated...
  352. Message-ID: <9205050133.AA24032@andy.bgsu.edu>
  353. Newsgroups: fa.think-c
  354. Lines: 127
  355. Date: 5 May 92 01:33:59 GMT
  356.  
  357.  
  358.     I have a very strange bug.  Somewhere in the following code,
  359. something happens which makes my application not accept a keypress
  360. when running.  All I get are beeping sounds whenever a key is pressed.
  361. I created a file to output every event, giving all of the fields like
  362. what, where, etc.  The keyDown event is never seen by my application.
  363. When I go back to Think C (or anything else), there is no problem.
  364. This thing is really bugging me, and I have spent so much time with
  365. it that I do not know what could be going wrong (even if it is looking
  366. me in the face ;-).  If anyone sees a problem in this code that can
  367. be my bug, or if there is somewhere else I should check, please let
  368. me know so that I can get some sleep...
  369.  
  370.     The mac beeps on any keypress whether I build an application
  371. or if I run it from Think C...
  372.  
  373. void main(){
  374.     Boolean cmndown, shiftdown, ctrldown;
  375.     char *s;
  376.     int c, d;
  377. /*
  378.     Initialization routines...
  379. */
  380.     initialize(FALSE);
  381.     UnloadSeg(initialize);
  382.  
  383.     for (;;) {
  384.  
  385.         doIdle();
  386.  
  387.         WaitNextEvent(everyEvent, &myEvent, 0L, 0L);
  388.  
  389.         HandleEvent();
  390.  
  391.     } /* end of main event loop */
  392. }
  393.  
  394. void initialize(Boolean aeGenerated){
  395.  
  396. /* Will be true if we got the init command as an apple event. */
  397.  
  398.     if (!aeGenerated){
  399.         ToolBoxInit();
  400.  
  401.         initGlobals();
  402.         canWaitNext = IsWNEIsImplemented();
  403.         if (HasAppleEvents){
  404.             InitMyAppleEvents();
  405.         }
  406.         initCTB();
  407.     }
  408.  
  409.  
  410.     SetUpMenus();
  411.  
  412.     StartCTB();
  413. }
  414.  
  415. void ToolBoxInit(void){
  416.  
  417.     InitGraf(&qd.thePort);
  418.     InitFonts();
  419.     FlushEvents (everyEvent,0);
  420.     InitWindows();
  421.     InitMenus();
  422.     TEInit();
  423.     InitDialogs(quit);
  424.     InitCursor();
  425.  
  426.     InitCRM();
  427.     InitCTBUtilities();
  428.     InitCM();
  429.     InitTM();
  430.  
  431.     MoreMasters();
  432.     MoreMasters();
  433. }
  434.  
  435. void initCTB(void){
  436.     OSErr err;
  437.  
  438.     termWindow=GetNewWindow(128,NIL,(WindowPtr)-1);
  439.  
  440.     SetPort(termWindow);
  441.  
  442.     termRect= termWindow->portRect;
  443.  
  444.     gTerm=NIL;
  445.     gConn=NIL;
  446.     gBuffer=NIL;
  447.  
  448.     CRMGetIndToolName(classTM,1,toolName);
  449.     termID=TMGetProcID(toolName);
  450.     gTerm=TMNew(&termRect,&termRect,tmSaveBeforeClear,termID,termWindow,mySendProc,myCacheProc,myBreakProc,NIL,myEnvironsProc,0,0);
  451.  
  452.     connSizes[cmDataIn]=1024;
  453.     connSizes[cmDataOut]=1024;
  454.     connSizes[cmCntlIn]=0;
  455.     connSizes[cmCntlOut]=0;
  456.     connSizes[cmAttnIn]=0;
  457.     connSizes[cmAttnOut]=0;
  458.  
  459.     CRMGetIndToolName(classCM,1,toolName);
  460.     connID=CMGetProcID(toolName);
  461.     gConn=CMNew(connID,cmData /* flags*/,connSizes,0,0);
  462.  
  463.     gBuffer=NewPtr(1024);
  464.  
  465. }
  466.  
  467. void StartCTB(void){
  468.     int result;
  469.     Point wheretoput={50,50};
  470.  
  471.     result=CMChoose(&gConn,wheretoput,myIdleProc);
  472.  
  473.     DoInitiate(); // initiates the connection
  474. }
  475.  
  476.  
  477.  
  478.     Thanks, I appreciate your time and patience...
  479.  
  480.     Dave
  481.  
  482.     dnebing@andy.bgsu.edu
  483.  
  484. 
  485. 
  486. Path: ucivax!gateway
  487. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  488. Subject: Re: New Dialog Routines
  489. Message-ID: <9205050202.AA25396@andy.bgsu.edu>
  490. Newsgroups: fa.think-c
  491. Lines: 16
  492. Date: 5 May 92 02:03:00 GMT
  493.  
  494.     SetDialogTracksCursor(gConvertDialog, FALSE );
  495.  
  496. From Tech Note #304
  497.  
  498. /* Tells the Dialog Manager that there is an edit line in this dialog, and */
  499. /* it should track and change to an I-Beam cursor when over the edit line */
  500. pascal OSErr SetDialogTracksCursor(DialogPtr theDialog, Boolean tracks)
  501.     = { 0x303C, 0x0306, 0xAA68 };
  502.  
  503.     To me, it looks like you're telling the Dialog Manager _NOT_ to
  504. track the cursor by sending it the FALSE value.  You probably just need
  505. to send it a TRUE value...
  506.  
  507.     Dave Nebinger
  508.  
  509.     dnebing@andy.bgsu.edu
  510. 
  511. 
  512. Path: ucivax!gateway
  513. From: BEASON@uno.cc.geneseo.edu (Bob Beason)
  514. Subject: #if bug in THINK C 5.0?
  515. Message-ID: <01GJMNSLQ9WK000E0T@geneseo.bitnet>
  516. Newsgroups: fa.think-c
  517. X-VMS-To: IN%"think-c@ics.uci.edu"
  518. Lines: 6
  519. Date: 5 May 92 02:05:18 GMT
  520.  
  521. I have been trying to use the #if statement in THINK C 5.02, but keep getting
  522. a syntax error or the statement doesn't work.  It makes no difference whether
  523. I use an expression or a constant, the results are the same.  Is this a
  524. bug?
  525. Bob Beason
  526. beason@geneseo.bitnet
  527. 
  528. 
  529. Path: ucivax!gateway
  530. From: kkirksey@eng.auburn.edu ("Kenneth B. Kirksey")
  531. Subject: More Dialog Fon
  532. Full-Name: Kenneth B. Kirksey
  533. Message-ID: <9205050309.AA22419@eng.auburn.edu>
  534. Newsgroups: fa.think-c
  535. Lines: 13
  536. Date: 5 May 92 03:09:59 GMT
  537.  
  538.  
  539. The question that I posted earlier had a mistake in the code. The line
  540.  
  541. SetDialogTracksCursor(gConvertDialog, FALSE );
  542.  
  543. Should read
  544.  
  545. SetDialogTracksCursor(gConvertDialog, TRUE);
  546.  
  547. I tried it both ways for funzies, and it still didn't work. Sorry for
  548. the confusion.
  549.  
  550.                                      Ken
  551. 
  552. 
  553. Path: ucivax!gateway
  554. From: halifax%admiral.UUCP@cs.yale.edu
  555. Subject: (none)
  556. Message-ID: <9205041655.aa08345@admiral.uucp>
  557. X-Mailer: SCO System V Mail (version 3.2)
  558. Newsgroups: fa.think-c
  559. Lines: 44
  560. Date: 5 May 92 03:58:29 GMT
  561.  
  562. From halifax  Mon, 04 May 92 16:55:26 EDT
  563. To: think-c@ics.uci.edu
  564. Subject: Fractal Generator - Errors/Etc.
  565. From: admiral.uucp!halifax@uunet.uu.net (Nathan Neulinger)
  566. Message-ID: <3aP0JB1w164w@admiral.uucp>
  567. Date: Mon, 04 May 92 16:55:25 EDT
  568. Organization: The Grid/Waffle BBS, 203-661-2873, -1279, -0450, -2967
  569.  
  570. Ok, to the few of you that have helped me out.. Thanks alot... Many of
  571. you asked for more specific information as to the errors I was
  572. experiencing...
  573.  
  574. One: The program runs fine if I let it sit there... But if I got to
  575. select another window of mine (of this program's), i get a System Erro
  576. #25 at 00408496 which is _StuffHex+018E
  577.  
  578. Two: If I choose a particular menu command - Generate or Redraw... i get
  579. a System Error #11 - Misc. Exception Error
  580.  
  581. Three: (Not important at the moment) For some reason, I could not get one
  582. of my Hierarchical menus to load rpoperly... I could get two of them to
  583. appear, but this one menu command, no matter what I did, it wouldn't
  584. bring up the submenu... I had all the fields set properly in ResEdit
  585. (2.1).. and loaded it with InsertMenu( ..., hierMenu);
  586.  
  587. I am running Think C 5.0.2 (Just upgraded), on a Mac Plus with 4MB... I
  588. am using System 7.0 (not upgraded yet)...
  589.  
  590. If anyone has any suggestions, please respond... If anyone is interested
  591. in trying to help me out, I could email you a copy of the source code and
  592. the resource file (i'd have to use SADeRez right?).... If you'd take a
  593. look at it.. However, i'd rather not dirtribute the source too much...
  594.  
  595. Thanks All,
  596. Nathan Neulinger
  597.  
  598. admiral!halifax@uunet.uu.net
  599.  
  600.  
  601. --
  602. admiral!halifax@uunet.uu.net (Nathan Neulinger) <uunet!admiral!halifax>
  603. The Admiral's Public UNIX - Greenwich, CT - System Administrator: Doug Fields
  604. (HST/V32) (203)661-2873 -- (PEP/V32) -1279 -- (V32) -0450 -- (V29/MNP6) -2967
  605. >FREE!< Unix shell accounts, Usenet access, and Internet-style mail available
  606. 
  607. 
  608. Path: ucivax!gateway
  609. From: slosser@mindseye.berkeley.edu (Eric Slosser)
  610. Subject: (none)
  611. Message-ID: <9205050856.AA13230@mindseye.berkeley.edu>
  612. In-Reply-To: halifax%admiral.UUCP@cs.yale.edu's message of 3 May 92 03:15:15 GMT <9205022227.aa10832@admiral.uucp>
  613. Newsgroups: fa.think-c
  614. Lines: 24
  615. Date: 5 May 92 08:56:07 GMT
  616.  
  617.  
  618. > ... but now it doesn't work... I am getting alot of Odd
  619. > Address errors... and also illegal instruction errors... it's weird... I
  620. > cannot seem to find what the problem is...
  621.  
  622. Here's some trouble-shooting advice:
  623. When you get the error (odd-address or ill-instruct), drop into macsbug.
  624. Look at the code around the program counter.  (Using IP or "DM PC-30 60").
  625. Is it coherent 68000 code?  If so, check your compiler settings and make
  626. sure you're not doing something like:
  627.     char *p;
  628.     if ( *((short*)p)==foobar )
  629. (The above hits an odd-addr error on 68000's when p is odd)
  630.  
  631. If it's not coherent, if the DM command shows the same byte repeated over
  632. and over, or the assembly listing gives a lot of "ORI.B" instructions,
  633. then either code resource got written into (with a bad CopyBits, maybe) OR
  634. one of your routines trashed the stack and RTS'ed into the tall grass.
  635.  
  636. A simple "WH PC" will tell you which of these is the case.
  637.  
  638. The above is not intended to be an exhaustive troubleshoot, but let me
  639. know if it helps.
  640.  
  641. 
  642. 
  643. Path: ucivax!gateway
  644. From: slosser@mindseye.berkeley.edu (Eric Slosser)
  645. Subject: (none)
  646. Message-ID: <9205050901.AA13233@mindseye.berkeley.edu>
  647. In-Reply-To: zabin@rz-berlin.mpg.de's message of 3 May 92 19:35:34 GMT <0095a0b1.945a7720.11198@RZ-Berlin.MPG.DE>
  648. Newsgroups: fa.think-c
  649. Lines: 7
  650. Date: 5 May 92 09:01:28 GMT
  651.  
  652.  
  653. You may be getting garbage when you read the file because you
  654. haven't done:
  655.     err = SetFPos(TheInRef,fsFromStart,0);
  656.  
  657. Assuming, of course, that all your memory got allocated...
  658.  
  659. 
  660. 
  661. Path: ucivax!gateway
  662. From: LEDGER@manadon-engineering-college.ac.uk
  663. Subject: Removal from list
  664. Via: manadon-engineering-college.ac.uk; Tue, 5 May 1992 11:40:00 +0100
  665. Message-ID: <9205050629.aa12855@q2.ics.uci.edu>
  666. Newsgroups: fa.think-c
  667. Lines: 1
  668. Date: 5 May 92 13:29:55 GMT
  669.  
  670. Please remove me from the mailing list... Thanks
  671. 
  672. 
  673. Path: ucivax!gateway
  674. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  675. Subject: Re: (none)
  676. Message-ID: <9205051413.AA29024@hobbes.kzoo.edu>
  677. In-Reply-To: <9205041655.aa08345@admiral.uucp>; from "halifax%admiral.UUCP@cs.yale.edu" at May 5, 92 3:58 am
  678. X-Mailer: ELM [version 2.3 PL11]
  679. Newsgroups: fa.think-c
  680. Lines: 29
  681. Date: 5 May 92 14:11:32 GMT
  682.  
  683. > One: The program runs fine if I let it sit there... But if I got to
  684. > select another window of mine (of this program's), i get a System Erro
  685. > #25 at 00408496 which is _StuffHex+018E
  686.  
  687. Yow.  Sounds like either a jump to someplace inappropriate (you aren't
  688. really using StuffHex, I hope), or just an error in an unnamed ROM
  689. routine.  Probably the latter.  Error 25 is, I believe, QuickDraw
  690. running out of memory.
  691.  
  692. > Two: If I choose a particular menu command - Generate or Redraw... i get
  693. > a System Error #11 - Misc. Exception Error
  694. >
  695. > Three: (Not important at the moment) For some reason, I could not get one
  696. > of my Hierarchical menus to load rpoperly... I could get two of them to
  697. > appear, but this one menu command, no matter what I did, it wouldn't
  698. > bring up the submenu... I had all the fields set properly in ResEdit
  699. > (2.1).. and loaded it with InsertMenu( ..., hierMenu);
  700.  
  701. These two may be related.  Keep in mind that the first word of a menu
  702. has to match its ID.  Open any suspect menus in "view as hex" format,
  703. and change that first word if necessary.
  704.  
  705. Step through with a debugger (Think's, or Macsbug, either one) and
  706. figure out exactly where that System Error #11 occurs.
  707. --
  708.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  709.  "A common way to answer a question about C is to 'see what the compiler
  710.   does.'  Clearly C has suffered from being partly defined, then
  711.   implemented." - High C language reference manual, 1987
  712. 
  713. 
  714. Path: ucivax!gateway
  715. From: chai@hawk.cs.ukans.edu ("Life, God is gracious.")
  716. Subject: leaving
  717. Message-ID: <9205051154.aa23390@hawk.cs.ukans.edu>
  718. Newsgroups: fa.think-c
  719. Lines: 2
  720. Date: 5 May 92 16:55:00 GMT
  721.  
  722. Well, the semester's drawing to a close, and I soon will be leaving this
  723. university... so thanks for the memories (RAM or ROM? 8-) and goodbye.
  724. 
  725. 
  726. Path: ucivax!gateway
  727. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  728. Subject: Re:  Keypress causes mac to beep, but no event is generated...
  729. Message-ID: <9205052045.AA12291@andy.bgsu.edu>
  730. Newsgroups: fa.think-c
  731. Lines: 13
  732. Date: 5 May 92 20:57:13 GMT
  733.  
  734.     I have discovered the source of my error.  I had been using
  735. the console to pump information about what was happening in my program
  736. so that I could track it.  Well it seems that the console was taking
  737. my keypresses, and not letting my event routine handle it itself.
  738.  
  739.     After removing the debugging code, my app started to receive
  740. the keypress events.
  741.  
  742.     Thanks,
  743.  
  744.         Dave
  745.  
  746.     dnebing@andy.bgsu.edu
  747. 
  748. 
  749. Path: ucivax!gateway
  750. From: sidar@complex.is (Sigurdur Darri Skulason)
  751. Subject: need info about vt102 ctb tool
  752. Message-ID: <9205060443.AA00246@complex.is>
  753. X-Mailer: ELM [version 2.3 PL11]
  754. Newsgroups: fa.think-c
  755. X-Charset: ASCII
  756. Lines: 25
  757. Date: 6 May 92 04:42:08 GMT
  758. X-Char-Esc: 29
  759.  
  760. I am writing an application which uses the vt102 ctb tool.
  761. However, it has the flaw of only being 7 bit and the icelandic
  762. character set needs 20 extra characters, so I have to use icelandic
  763. characters instead of a number of symbols like [, } etc.
  764. The only way of then showing these symbols would be to switch
  765. back to the us ascii set and then back again.
  766.  
  767. That however slows down the program quite a bit, but a way to speed things
  768. up a bit might be to use the temporary character sets G2 and G3.
  769.  
  770. And that is the problem I want to ask about. According to the documentation
  771. these temporary character sets can be used to display one character and
  772. then automatically switch back to the old char set, which seems to be
  773. excactly what I need to. However, there seems to be NO documentation about
  774. how to select these character sets in this temporary way ?!?
  775.  
  776. Can anyone inform me about how to select them? Or if there is any
  777. better way to bypass this 7-bit limitation? I would really appreciate
  778. any information.
  779.  
  780. --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
  781. Sigurdur Darri Skulason                                    sidar@complex.is
  782. Hugsun inc.                                               Fax:+354-1-626823
  783. Laugavegur 59,IS-101 Reykjavik,Iceland
  784. Tel:  +354-1-626822  /  +354-1-616822  /  +31-20-665-6467  /  +46-171-58212
  785. 
  786. 
  787. Path: ucivax!gateway
  788. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  789. Subject: Is everyone getting this?
  790. Message-ID: <9205061610.AA08556@andy.bgsu.edu>
  791. Newsgroups: fa.think-c
  792. Lines: 13
  793. Date: 6 May 92 16:11:11 GMT
  794.  
  795.  
  796.     It seems that someone named King has changed his email address,
  797. but not notified the list.  Whenever I post a letter to the mailing list,
  798. eventually I recieve a notice from a Michael Tillman from Duke that says
  799. that King's email address has been changed, and that I should use the
  800. new address the next time I mail to him.
  801.  
  802.     Is this only happening to me, or has everyone been getting them?
  803.  
  804.     Just wondering,
  805.  
  806.         Dave
  807.         dnebing@andy.bgsu.edu
  808. 
  809. 
  810. Path: ucivax!gateway
  811. From: johnsone@uxh.cso.uiuc.edu ("Erik A. Johnson")
  812. Subject: Re: Is everyone getting this?
  813. Message-ID: <199205070320.AA18259@uxh.cso.uiuc.edu>
  814. Newsgroups: fa.think-c
  815. Lines: 17
  816. Date: 7 May 92 03:20:39 GMT
  817.  
  818. dnebing@andy.bgsu.edu writes:
  819. > Whenever I post a letter to the mailing list,
  820. > eventually I recieve a notice from a Michael Tillman from Duke that says
  821. > that King's email address has been changed, and that I should use the
  822. > new address the next time I mail to him.
  823. >
  824. >   Is this only happening to me, or has everyone been getting them?
  825.  
  826. I haven't gotten anything like that.
  827.  
  828.  
  829. Erik A. Johnson        \    Internet: johnsone@uxh.cso.uiuc.edu     \       |
  830. ------------------------\    AmericaOnline: ErikAJ                   \    --+--
  831. Graduate Student         \--------------------------------------------\     |
  832. Aero/Astro Engineering    \  "Jesus said to him, 'I am the way, and    \    |
  833. University of Illinois at  \  the truth, and the life; no one comes to  \   |
  834.    Urbana-Champaign (UIUC)  \  the Father except through me.'" (Jn14:6)  \
  835. 
  836. 
  837. Path: ucivax!gateway
  838. From: johnsone@uxh.cso.uiuc.edu ("Erik A. Johnson")
  839. Subject: Re: Is everyone getting this?
  840. Message-ID: <199205070812.AA25170@uxh.cso.uiuc.edu>
  841. Newsgroups: fa.think-c
  842. Lines: 24
  843. Date: 7 May 92 08:12:47 GMT
  844.  
  845. dnebing@andy.bgsu.edu writes:
  846. > Whenever I post a letter to the mailing list,
  847. > eventually I recieve a notice from a Michael Tillman from Duke that says
  848. > that King's email address has been changed, and that I should use the
  849. > new address the next time I mail to him.
  850. >
  851. >   Is this only happening to me, or has everyone been getting them?
  852.  
  853. I responded:
  854. > I haven't gotten anything like that.
  855.  
  856. And about the same time my response got back to me on think-c, I got
  857. a similar message from Michael Tillman at Duke.  Sorry.
  858.  
  859. So what's the deal?  Someone needs to change this guy's address in the
  860. think-c master address list or something?
  861.  
  862.  
  863. Erik A. Johnson        \    Internet: johnsone@uxh.cso.uiuc.edu     \       |
  864. ------------------------\    AmericaOnline: ErikAJ                   \    --+--
  865. Graduate Student         \--------------------------------------------\     |
  866. Aero/Astro Engineering    \  "Jesus said to him, 'I am the way, and    \    |
  867. University of Illinois at  \  the truth, and the life; no one comes to  \   |
  868.    Urbana-Champaign (UIUC)  \  the Father except through me.'" (Jn14:6)  \
  869. 
  870. 
  871. Path: ucivax!gateway
  872. From: halifax%admiral.UUCP@cs.yale.edu
  873. Subject: (none)
  874. Message-ID: <9205071509.aa00611@admiral.uucp>
  875. X-Mailer: SCO System V Mail (version 3.2)
  876. Newsgroups: fa.think-c
  877. Lines: 29
  878. Date: 8 May 92 03:30:47 GMT
  879.  
  880. From halifax  Thu, 07 May 92 15:09:00 EDT
  881. To: think-c@ics.uci.edu
  882. Subject: More on the fractal generator...
  883. From: admiral.uucp!halifax@uunet.uu.net (Nathan Neulinger)
  884. Message-ID: <PD5ekB2w164w@admiral.uucp>
  885. Date: Thu, 07 May 92 15:09:00 EDT
  886. Organization: The Grid/Waffle BBS, 203-661-2873, -1279, -0450, -2967
  887.  
  888. I found where a couple of the errors occur... They happen at the end of a
  889. function, where it is about to return to the calling function...
  890.  
  891. I still have not found any code in my program that is likely to cause
  892. this... I do very little with handles and/or pointers... I have one main
  893. pointer that i use.. I dynamically allocate (using calloc), a two
  894. dimensional array of ints.... However, I check the returns on these
  895. functions...
  896.  
  897.  
  898. Again... If anyone has any suggestions, I would appreciate the help...
  899.  
  900. Also, I f anyone would be willing to look at the source code and try to
  901. find the problem, I have the source, and resources binhexed, so I coul
  902. mail them to you... Drop me a mail if youre interested...
  903.  
  904. --
  905. admiral!halifax@uunet.uu.net (Nathan Neulinger) <uunet!admiral!halifax>
  906. The Admiral's Public UNIX - Greenwich, CT - System Administrator: Doug Fields
  907. (HST/V32) (203)661-2873 -- (PEP/V32) -1279 -- (V32) -0450 -- (V29/MNP6) -2967
  908. >FREE!< Unix shell accounts, Usenet access, and Internet-style mail available
  909. 
  910. 
  911. Path: ucivax!gateway
  912. From: zabin@rz-berlin.mpg.de
  913. Subject: Are you using an IBM mailer?
  914. Message-ID: <0095a43c.3ef319c0.12332@RZ-Berlin.MPG.DE>
  915. Newsgroups: fa.think-c
  916. Lines: 10
  917. Date: 8 May 92 07:46:07 GMT
  918.  
  919. I am using LeeMail on the mac to receive e-mail, and someone seems to be using
  920. an IBM mailer to try and respond to a question I posted. PLEASE STOP! LeeMail
  921. for some reason crashes when an IBM mailer attempts to connect! This has been
  922. going on for about 5 days - if you are using an IBM mailer to try and contact
  923. hbz@zabin.rz-berlin.mpg.de please stop it!"!!!
  924. Thank you, Hal B. Zabin
  925.  
  926. ZABIN@RZ-BERLIN.MPG.DE
  927. Max-Planck-Institut fuer molekulare Genetik
  928. Berlin, Germany
  929. 
  930. 
  931. Path: ucivax!gateway
  932. From: dnebing@andy.bgsu.edu ("Mr. Neb")
  933. Subject: Answers to "Is Everyone Getting This..."
  934. Message-ID: <9205081615.AA27334@andy.bgsu.edu>
  935. Newsgroups: fa.think-c
  936. Lines: 9
  937. Date: 8 May 92 16:15:35 GMT
  938.  
  939.  
  940.     From the responses that I have gotten, 5 people are recieving the
  941. email that I referred to before (I even got a new one with that posting)
  942. and 5 people are not getting the email about the change in address.
  943.  
  944.     Quite different, No?
  945.  
  946.     Dave
  947.     dnebing@andy.bgsu.edu
  948. 
  949. 
  950. Path: ucivax!gateway
  951. From: johnsone@uxh.cso.uiuc.edu ("Erik A. Johnson")
  952. Subject: Re: Answers to "Is Everyone Getting This..."
  953. Message-ID: <199205082043.AA17737@uxh.cso.uiuc.edu>
  954. Newsgroups: fa.think-c
  955. Lines: 20
  956. Date: 8 May 92 20:43:45 GMT
  957.  
  958. Dave,
  959.  
  960. >     From the responses that I have gotten, 5 people are recieving the
  961. > email that I referred to before (I even got a new one with that posting)
  962. > and 5 people are not getting the email about the change in address.
  963. >
  964. >     Quite different, No?
  965.  
  966. The only times I got that message were when I sent mail to think-c.
  967. Not for anyone elses posts to think-c.  Is it possible that the daemon
  968. or person that is bouncing the mail is sending it only to the person who
  969. originated the post?
  970.  
  971.  
  972. Erik A. Johnson        \    Internet: johnsone@uxh.cso.uiuc.edu     \       |
  973. ------------------------\    AmericaOnline: ErikAJ                   \    --+--
  974. Graduate Student         \--------------------------------------------\     |
  975. Aero/Astro Engineering    \  "Jesus said to him, 'I am the way, and    \    |
  976. University of Illinois at  \  the truth, and the life; no one comes to  \   |
  977.    Urbana-Champaign (UIUC)  \  the Father except through me.'" (Jn14:6)  \
  978. 
  979. 
  980. Path: ucivax!gateway
  981. From: sidar@complex.is (Sigurdur Darri Skulason)
  982. Subject: Re: Answers to "Is Everyone Getting This..."
  983. Message-ID: <9205082143.AA01173@complex.is>
  984. In-Reply-To: <199205082043.AA17737@uxh.cso.uiuc.edu>; from "Erik A. Johnson" at May 8, 92 8:43 pm
  985. X-Mailer: ELM [version 2.3 PL11]
  986. Newsgroups: fa.think-c
  987. X-Charset: ASCII
  988. Lines: 21
  989. Date: 8 May 92 21:41:41 GMT
  990. X-Char-Esc: 29
  991.  
  992. >
  993. > Dave,
  994. >
  995. > >     From the responses that I have gotten, 5 people are recieving the
  996. > > email that I referred to before (I even got a new one with that posting)
  997. > > and 5 people are not getting the email about the change in address.
  998. > >
  999. > >     Quite different, No?
  1000. >
  1001. > The only times I got that message were when I sent mail to think-c.
  1002. > Not for anyone elses posts to think-c.  Is it possible that the daemon
  1003. > or person that is bouncing the mail is sending it only to the person who
  1004. > originated the post?
  1005.  
  1006. Wery likely since I can say the same, getting this reply when I posted.
  1007.  
  1008. --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
  1009. Sigurdur Darri Skulason                                    sidar@complex.is
  1010. Hugsun inc.                                               Fax:+354-1-626823
  1011. Laugavegur 59,IS-101 Reykjavik,Iceland
  1012. Tel:  +354-1-626822  /  +354-1-616822  /  +31-20-665-6467  /  +46-171-58212
  1013. 
  1014. 
  1015. Path: ucivax!gateway
  1016. From: king@acpub.duke.edu (King Rhoton)
  1017. Subject: Is everyone...
  1018. Message-ID: <9205090231.AA26464@raphael.acpub.duke.edu>
  1019. Newsgroups: fa.think-c
  1020. Lines: 6
  1021. Date: 9 May 92 02:31:23 GMT
  1022.  
  1023. Yes, I am aware that people are getting this forwarding message.  I have tried
  1024. three times to get my old address changed at the think-c host, to no avail.
  1025. I am still working on it, but if anyone has any other advice about how to do
  1026. it besides sending mail to think-c-request, I'd love to hear from you.
  1027. (Besides, changing addresses in the first place was not even my decision....)
  1028. King
  1029. 
  1030. 
  1031. Path: ucivax!gateway
  1032. From: Marissa_Henderson.Roch@xerox.com
  1033. Subject: File Comparison Utility Script
  1034. Message-ID: <"11-May-929:20:56".*.Marissa_Henderson.roch@Xerox.com>
  1035. In-Reply-to: <92Apr30.212005pdt.12042@alpha.xerox.com>
  1036. Newsgroups: fa.think-c
  1037. Reply-to: "mhend.roch@xerox.com .Roch"@xerox.com
  1038. X-NS-Transport-ID: 0000AA0084559F262DCE
  1039. Lines: 37
  1040. Date: 11 May 92 14:20:09 GMT
  1041.  
  1042. I have a question.
  1043.  
  1044. Does anyone have a program or code that could compare lines in a document by
  1045. field?
  1046.  
  1047.  
  1048.     i.e.    Sample output from FileList+
  1049.  
  1050. Filename        Size    Version    Date Created        Path
  1051. -----------          ----    ------          ----------
  1052. ------------
  1053. Excel 92 Budget    20K            1/5/92            Documents:Excel
  1054.  
  1055. Spreads:
  1056. Budget for 92        24K            12/31/91        Warped
  1057. Drive:Misc
  1058.                                     Spreads
  1059.  
  1060. I have looked at FileList+ (the most recent version) and XCat, among others.
  1061. However, these packages do not seem to have a robust matching algorithm.
  1062.  
  1063. When I perform a match, I first check for the same filename and size
  1064. (duplicates).  Then I would like to match based on similar names (i.e. to
  1065. locate multiple revisions of an application - Word 3.0 vs. Word 4.0).
  1066. FileList+ and the other packages I have tried cannot handle the second case.
  1067. When it compares filenames, it will sort them alphabetically and therefore
  1068. would not pick up on the sample above.
  1069.  
  1070. Does anyone have any ideas?
  1071.  
  1072.  
  1073. Thanks in advance,
  1074.  
  1075. Marissa Henderson
  1076. Systems Analyst
  1077. Xerox Corporation
  1078. MHEND.ROCH@XEROX.COM
  1079. 
  1080. 
  1081. Path: ucivax!gateway
  1082. From: PNCSPPC@ccvax1.cc.ncsu.edu
  1083. Subject: How to subscribe?
  1084. Message-ID: <9205111713.AA22434@ncsuvx.ncsu.edu>
  1085. Posted-Date: Mon, 11 May 92 13:15:33 EDT
  1086. Newsgroups: fa.think-c
  1087. Lines: 8
  1088. Date: 11 May 92 17:15:56 GMT
  1089.  
  1090. Could someone please tell me how to subscribe to this list?
  1091.  
  1092. Phil Calvert
  1093.  
  1094. ****************************************
  1095. * Bitnet: pncsppc@ncsuvax              *
  1096. * Internet: pncsppc@ccvax1.cc.ncsu.edu *
  1097. ****************************************
  1098. 
  1099. 
  1100. Path: ucivax!gateway
  1101. From: abw@bucrsb.bu.edu
  1102. Subject: How to subscribe?
  1103. Message-ID: <199205111839.AA03356@natchez.bu.edu>
  1104. In-Reply-To: PNCSPPC@ccvax1.cc.ncsu.edu's message of 11 May 92 17:15:56 GMT <9205111713.AA22434@ncsuvx.ncsu.edu>
  1105. Newsgroups: fa.think-c
  1106. Lines: 34
  1107. Date: 11 May 92 18:37:38 GMT
  1108.  
  1109. Here's an old msg that will help.
  1110.  
  1111. Put
  1112.  
  1113. subscribe
  1114.  
  1115. in the msg body (or maybe it's the subject line...oh, shucks, put it
  1116. in both. One is bound to work.
  1117.  
  1118.                             ---Al
  1119.  
  1120. From hanche@imf.unit.no Thu Feb 27 09:19:36 1992
  1121. Return-Path: <fa.think-c-outbound-request@ics.uci.edu>
  1122. From: Harald Hanche-Olsen <hanche@imf.unit.no>
  1123. Subject: think c mailing list
  1124. Newsgroups: fa.think-c
  1125. Date: 27 Feb 92 07:12:58 GMT
  1126. To: think-c@ics.uci.edu
  1127.  
  1128.    From: Fred Swartz <swartz@terminator.cc.umich.edu>
  1129.    Newsgroups: fa.think-c
  1130.    Date: 27 Feb 92 05:33:22 GMT
  1131.  
  1132.    Could you please add me to your think-c mailing list.  Thanks
  1133.      -- Fred  (fred.swartz@terminator.cc.umich.edu)
  1134.  
  1135. Nope.  Write to think-c-request@ics.uci.edu, not the list address.
  1136.  
  1137. - Harald Hanche-Olsen <hanche@imf.unit.no>   +47-7-593525
  1138.   Division of Mathematical Sciences
  1139.   The Norwegian Institute of Technology
  1140.   N-7034 Trondheim, NORWAY
  1141.  
  1142.  
  1143. 
  1144. 
  1145. Path: ucivax!gateway
  1146. From: igorl@uiuc.edu (Igor Livshits)
  1147. Subject: Array of bits?
  1148. Message-ID: <9205122348.AA01153@newton.ncsa.uiuc.edu>
  1149. Newsgroups: fa.think-c
  1150. Lines: 9
  1151. Date: 12 May 92 23:48:37 GMT
  1152.  
  1153. Hello,
  1154.  
  1155. Is there a way to create an array of bits in THINK C?
  1156.  
  1157. I don't want to waste the memory for
  1158. Boolean inactive[180];
  1159.  
  1160. Thanks for your help, Igor
  1161.  
  1162. 
  1163. 
  1164. Path: ucivax!gateway
  1165. From: PNCSPPC@ccvax1.cc.ncsu.edu
  1166. Subject: Any small sample code in 'C'?
  1167. Message-ID: <9205130113.AA00423@ncsuvx.ncsu.edu>
  1168. Posted-Date: Tue, 12 May 92 21:16:28 EDT
  1169. Newsgroups: fa.think-c
  1170. Lines: 16
  1171. Date: 13 May 92 01:16:43 GMT
  1172.  
  1173. Hello!  Anyone out there know of any public domain 'C' code that's
  1174. available for downloading, and which would be good for a beginner to
  1175. tinker around with?  I want to learn 'C' but I don't want to type in those
  1176. stupid little programs, that don't do anything useful, one commonly
  1177. finds in books on how to learn 'C'.  Preferably, the code should be in
  1178. ANSI 'C' and be highly portable (or be written specifically for THINK C).
  1179. Thanks in advance for any help.
  1180.  
  1181. Sincerely,
  1182.  
  1183. Phil Calvert
  1184.  
  1185. ****************************************
  1186. * Bitnet: pncsppc@ncsuvax              *
  1187. * Internet: pncsppc@ccvax1.cc.ncsu.edu *
  1188. ****************************************
  1189. 
  1190. 
  1191. Path: ucivax!gateway
  1192. From: neuling%admiral.UUCP@cs.yale.edu (Nathan Neulinger)
  1193. Subject: HOORAY!!!!!!!"!!!
  1194. Message-ID: <9205122134.aa14952@admiral.uucp>
  1195. X-Mailer: SCO System V Mail (version 3.2)
  1196. Newsgroups: fa.think-c
  1197. Lines: 19
  1198. Date: 13 May 92 03:31:01 GMT
  1199.  
  1200. To all of you out there who have helped with my problems with my
  1201. Fractal Generator program... thanks ALOT.... I finaly figured out what the
  1202. problem was...
  1203.  
  1204. The worst thing was, it had almost nothing to do with pointers or handles or anything like that...
  1205.  
  1206.  a bunch of SetPort calls in various locations throughout my program, I fixed the entire problem with crashing...
  1207.  
  1208. NOW: I only have two remaining problems:
  1209.  
  1210. 1. How to speed up color printing - or printing at all... at the moment it is extremely slow...
  1211.  
  1212. 2. How to write out the graphics data in various file formats
  1213.  
  1214. Thanks all...
  1215.  
  1216. Nathan
  1217. admiral!halifax@uunet.uu.net
  1218. /s
  1219. 
  1220. 
  1221. Path: ucivax!gateway
  1222. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  1223. Subject: Re: Array of bits?
  1224. Message-ID: <9205131233.AA20713@hobbes.kzoo.edu>
  1225. In-Reply-To: <9205122348.AA01153@newton.ncsa.uiuc.edu>; from "Igor Livshits" at May 12, 92 11:48 pm
  1226. X-Mailer: ELM [version 2.3 PL11]
  1227. Newsgroups: fa.think-c
  1228. Lines: 24
  1229. Date: 13 May 92 12:32:02 GMT
  1230.  
  1231. > Is there a way to create an array of bits in THINK C?
  1232. >
  1233. > I don't want to waste the memory for
  1234. > Boolean inactive[180];
  1235.  
  1236. Not really;  you have to fudge it.  C has these two conflicting rules:
  1237. first, that "x[y]" can always be read as "*(x+y)", and second, that you
  1238. can't take the address of a bit field (K&R, 2nd ed., the last sentence
  1239. in chapter 6).
  1240.  
  1241. The best you can do is to fudge it:
  1242.  
  1243. typedef struct {
  1244.     unsigned int b00:1,b01:1,b02:1,b03:1,b04:1,b05:1,b06:1,b07:1,
  1245.        b08:1,b09:1,b10:1,b11:1,b12:1,b13:1,b14:1,b15:1;
  1246. } bfWord;
  1247. bfWord myArray[(180/16)+1];
  1248.  
  1249. (You'll have to do 16 of 'em since ThC pads structs to even size.)
  1250. --
  1251.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  1252.  "A common way to answer a question about C is to 'see what the compiler
  1253.   does.'  Clearly C has suffered from being partly defined, then
  1254.   implemented." - High C language reference manual, 1987
  1255. 
  1256. 
  1257. Path: ucivax!gateway
  1258. From: igorl@uiuc.edu (Igor Livshits)
  1259. Subject: Re:  Array of bits?
  1260. Message-ID: <9205131428.AA22321@newton.ncsa.uiuc.edu>
  1261. Newsgroups: fa.think-c
  1262. Lines: 30
  1263. Date: 13 May 92 14:28:29 GMT
  1264.  
  1265. Thank you to all who responded to my query.  Apparently, the only way to do
  1266. it is through a bit test of a chunk of memory.  I probably do not want to
  1267. sacrifice the time delay in favor of memory savings.
  1268.  
  1269. Thanks again, igor
  1270.  
  1271.  
  1272.  
  1273. >Date: Wed, 13 May 92 08:29:11 EDT
  1274. >X-Ph: V3.12@ux1.cso.uiuc.edu
  1275. >From: Brady Duga  <duga@cvs.rochester.edu>
  1276. >To: igorl@uiuc.edu
  1277. >Subject: Re:  Array of bits?
  1278. >
  1279. >How about :
  1280. >
  1281. >char inactive[NUMBER_O_FLAGS / 8];
  1282. >Then, to get flag x:
  1283. >
  1284. >div_t  d;
  1285. >
  1286. >d=div(x,8);
  1287. >if ( (inactive[d.quot] >> d.rem) & 0xFE) ...
  1288. >
  1289. >Of course, you could stick it all in a function, to make it look nicer.
  1290. >
  1291. >--Brady (duga@cvs.rochester.edu)
  1292. >
  1293. >
  1294.  
  1295. 
  1296. 
  1297. Path: ucivax!gateway
  1298. From: bobm@imagine.convex.com ("Bob (Mr. Grape loves ME!) Miller" )
  1299. Subject: Re: Array of bits?
  1300. Message-ID: <9205131904.AA27580@Mr_Grape.convex.com>
  1301. In-Reply-To: Your message of "13 May 92 14:28:29 GMT."
  1302.              <9205131428.AA22321@newton.ncsa.uiuc.edu>
  1303. Newsgroups: fa.think-c
  1304. Lines: 24
  1305. Date: 13 May 92 19:05:31 GMT
  1306.  
  1307. Something like this would work.
  1308.  
  1309. #define DECLARE_BIT_ARRAY(name, size) char name[((size) + 7) / 8]
  1310.                     /* round up to next byte */
  1311. #define BIT_TEST(array, bitno) ((array[(bitno) >> 3] & \
  1312.                  1 << ((bitno) & 7)) != 0)
  1313. #define BIT_SET(array, bitno)   (array[(bitno) >> 3] |=   1 << ((bitno) & 7))
  1314. #define BIT_CLEAR(array, bitno) (array[(bitno) >> 3] &= ~(1 << ((bitno) & 7)))
  1315.  
  1316. Then, to use,
  1317.  
  1318.     DECLARE_BIT_ARRAY(inactive, 180);
  1319.  
  1320.     if (BIT_TEST(inactive, i))
  1321.         BIT_CLEAR(inactive, i);
  1322.     else if (!(jk_is_inactive = BIT_TEST(inactive, j + k)))
  1323.         BIT_SET(inactive, j + k);
  1324.  
  1325. How long does it take?  Each macro is probably four or five
  1326. instructions more than if you used an array of Booleans.
  1327.  
  1328. This sort of bitwise fumbling is what C really excels at.
  1329.  
  1330.                     K<bob>
  1331. 
  1332. 
  1333. Path: ucivax!gateway
  1334. From: slosser@mindseye.berkeley.edu (Eric Slosser)
  1335. Subject: HOORAY!!!!!!!"!!!
  1336. Message-ID: <9205132119.AA28928@mindseye.berkeley.edu>
  1337. In-Reply-To: Nathan Neulinger's message of 13 May 92 03:31:01 GMT <9205122134.aa14952@admiral.uucp>
  1338. Newsgroups: fa.think-c
  1339. Lines: 5
  1340. Date: 13 May 92 21:18:59 GMT
  1341.  
  1342.  
  1343. If printing is really slow, you may be able to speed things
  1344. by first imaging onto an appropriately sized offscreen port,
  1345. then CopyBitsing into the printing port.
  1346.  
  1347. 
  1348. 
  1349. Path: ucivax!gateway
  1350. From: osc!vincent@ames.arc.nasa.gov (Vincent Tong)
  1351. Subject: Please remove me from the mailing list
  1352. Message-ID: <9205132152.AA18875@osc.com>
  1353. Newsgroups: fa.think-c
  1354. Lines: 2
  1355. Date: 14 May 92 00:23:31 GMT
  1356.  
  1357.  
  1358. Thanks
  1359. 
  1360. 
  1361. Path: ucivax!gateway
  1362. From: inei@dcs.glasgow.ac.uk (Nick Nei)
  1363. Subject: How to Show Init with TC5.
  1364. Message-ID: <11097.9205141425@dcs.glasgow.ac.uk>
  1365. Newsgroups: fa.think-c
  1366. Lines: 18
  1367. Date: 14 May 92 14:27:01 GMT
  1368.  
  1369.  
  1370. I have an INIT written with TC4, using ShowINIT() given in LightSpeed C
  1371. (version 2.15).  It has a bit of assembler like so:
  1372.  
  1373. #define CKSM(i)                \
  1374.     asm {                    \
  1375.         ROL #1,i            \
  1376.         EOR #0x1021,i        \
  1377.     }
  1378.  
  1379. But when I compile it with TC5, it says "Syntax Error".  I am not an
  1380. assembler afficionado.  I have a feeling there is something better than
  1381. ShowINIT() now.  Can anyone help?
  1382.  
  1383. Mail:  Nick Nei, Computing Science Dept.,
  1384.        Glasgow Univ., 17 Lilybank Gardens,
  1385.        Glasgow G12 8QQ, UK.  Tel: (041) 339 8855 x 5457
  1386. ARPA:  inei%uk.ac.glasgow.dcs@nsfnet-relay.ac.uk USENET: inei@cs.glasgow.uucp
  1387. 
  1388. 
  1389. Path: ucivax!gateway
  1390. From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
  1391. Subject: Linking problems...
  1392. Message-ID: <920514174509.23200b69@AZCC.Arizona.EDU>
  1393. Newsgroups: fa.think-c
  1394. Lines: 22
  1395. Date: 15 May 92 00:45:19 GMT
  1396. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  1397.  
  1398. Hi,
  1399.   I am Mac programming learner, so I am using the book The Macintosh Progamming
  1400. Primer. (Great book by the way. :))  Anyways, I am doing  one of the programs
  1401. from the book (PritPICT), and when I try to link it, it tells me that all of the
  1402. Prxxx functions are undefined.
  1403.  
  1404. Normally I would say, "Ah ha!  I forgot to include the header file for
  1405. Printing!", but after examining my code I discovered that it was there.  I am
  1406. using Think C version 5.
  1407.  
  1408. I looked through the Think C manual wondering if I had installed TC wrong, but
  1409. everything appears to be in order.
  1410.  
  1411. Does anybody, have any ideas, cause I am clean out. :(
  1412.  
  1413. Mike
  1414.  
  1415. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1416. Mike Ruhl
  1417. Operator
  1418. Arizona Cancer Center
  1419. mruhl@azcc.arizona.edu
  1420. 
  1421. 
  1422. Path: ucivax!gateway
  1423. From: bobm@imagine.convex.com ("Bob (Mr. Grape loves ME!) Miller" )
  1424. Subject: '040 cache flush
  1425. Message-ID: <9205150321.AA17117@Mr_Grape.convex.com>
  1426. Newsgroups: fa.think-c
  1427. Organization: The GrapE-ics Lab
  1428. Lines: 4
  1429. Date: 15 May 92 03:22:14 GMT
  1430.  
  1431. Is there a Toolbox call to flush a 68040's cache after modifying
  1432. instructions?  I haven't been able to find one.
  1433.  
  1434.                     K<bob>
  1435. 
  1436. 
  1437. Path: ucivax!gateway
  1438. From: ephraim@think.com (Ephraim Vishniac)
  1439. Subject: Re: '040 cache flush
  1440. Message-ID: <9205151110.AA11276@phobos.think.com>
  1441. In-Reply-To: Your message of "15 May 92 03:22:14 GMT."
  1442.              <9205150321.AA17117@Mr_Grape.convex.com>
  1443. Newsgroups: fa.think-c
  1444. Lines: 15
  1445. Date: 15 May 92 11:10:37 GMT
  1446.  
  1447.  
  1448.    Date:  15 May 92 03:22:14 GMT
  1449.    From:  "\"Bob (Mr. Grape loves ME!" <bobm@imagine.convex.com>, ")"@ics.uci.edu
  1450.  
  1451.    Is there a Toolbox call to flush a 68040's cache after modifying
  1452.    instructions?  I haven't been able to find one.
  1453.  
  1454. Look in the bottom of OSUtils.h:
  1455.  
  1456. pascal Boolean SwapInstructionCache(Boolean cacheEnable);
  1457. pascal void FlushInstructionCache(void);
  1458. pascal Boolean SwapDataCache(Boolean cacheEnable);
  1459. pascal void FlushDataCache(void);
  1460.  
  1461. Ephraim
  1462. 
  1463. 
  1464. Path: ucivax!gateway
  1465. From: babin@ra.csc.ti.com (Michael Babin)
  1466. Subject: Linking problems...
  1467. Message-ID: <9205151405.AA14157@ra.csc.ti.com>
  1468. In-Reply-To: The sky is ecstasy dancing's message of 15 May 92 00:45:19 GMT <920514174509.23200b69@AZCC.Arizona.EDU>
  1469. Newsgroups: fa.think-c
  1470. Lines: 7
  1471. Date: 15 May 92 14:05:52 GMT
  1472.  
  1473.  
  1474. Did you add one of the ANSI libraries (ANSI, ANSI-small, etc.) to your
  1475. project?  If not, then the linker can't find the object code for those
  1476. functions.
  1477.  
  1478. Mike Babin
  1479. babin@csc.ti.com
  1480. 
  1481. 
  1482. Path: ucivax!gateway
  1483. From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
  1484. Subject: Summary... :)
  1485. Message-ID: <920515092144.220023e3@AZCC.Arizona.EDU>
  1486. Newsgroups: fa.think-c
  1487. Lines: 18
  1488. Date: 15 May 92 16:21:54 GMT
  1489. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  1490.  
  1491. Hi again!
  1492.  
  1493.    Last night I went home and discovered that there is more to the Think C
  1494. manual than the Appendixes, and so I discovered what I was doing wrong.  In
  1495. order to use the header Printing.h, I would have needed to Add PrGlue as well.
  1496. This apperently is the "old" way of printing, and does not use the print
  1497. manager.  The "new" way is to use PrintTraps.h.  This has all of things needed
  1498. for backgroung printing with the print manger.  MacTraps2 was not needed.
  1499.  
  1500. Thanks for all of your answers. :)
  1501.  
  1502. Mike
  1503.  
  1504. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1505. Mike Ruhl
  1506. Operator/beginning Mac Programmer
  1507. Arizona Cancer Center
  1508. mruhl@azcc.arizona.edu
  1509. 
  1510. 
  1511. Path: ucivax!gateway
  1512. From: inei@dcs.glasgow.ac.uk (Nick Nei)
  1513. Subject: DES source code anyone?
  1514. Message-ID: <1067.9205160155@dcs.glasgow.ac.uk>
  1515. Newsgroups: fa.think-c
  1516. Lines: 11
  1517. Date: 16 May 92 01:55:41 GMT
  1518.  
  1519.  
  1520. Does anyone know of any PD available or willing to donate DES encryption
  1521. source code?  Either C or Pascal, but C preferred.  Either MPW or THINK,
  1522. but THINK preferred.
  1523.  
  1524. Thanks in salivating anticipation...
  1525.  
  1526. Mail:  Nick Nei, Computing Science Dept.,
  1527.        Glasgow Univ., 17 Lilybank Gardens,
  1528.        Glasgow G12 8QQ, UK.  Tel: (041) 339 8855 x 5457
  1529. ARPA:  inei%uk.ac.glasgow.dcs@nsfnet-relay.ac.uk USENET: inei@cs.glasgow.uucp
  1530. 
  1531. 
  1532. Path: ucivax!gateway
  1533. From: morris@think.com (Harry Morris)
  1534. Subject: DES source code anyone?
  1535. Message-ID: <9205160257.AA08832@quake.think.com>
  1536. In-Reply-To: Nick Nei's message of 16 May 92 01:55:41 GMT <1067.9205160155@dcs.glasgow.ac.uk>
  1537. Newsgroups: fa.think-c
  1538. Lines: 20
  1539. Date: 16 May 92 02:57:13 GMT
  1540.  
  1541.  
  1542. um, I may be wrong, but I'm pretty sure it's illegal to export DES out of
  1543. the United States.
  1544.  
  1545.  
  1546.  
  1547.    From: Nick Nei <inei@dcs.glasgow.ac.uk>
  1548.    Date: 16 May 92 01:55:41 GMT
  1549.  
  1550.  
  1551.    Does anyone know of any PD available or willing to donate DES encryption
  1552.    source code?  Either C or Pascal, but C preferred.  Either MPW or THINK,
  1553.    but THINK preferred.
  1554.  
  1555.    Thanks in salivating anticipation...
  1556.  
  1557.    Mail:  Nick Nei, Computing Science Dept.,
  1558.       Glasgow Univ., 17 Lilybank Gardens,
  1559.       Glasgow G12 8QQ, UK.  Tel: (041) 339 8855 x 5457
  1560.    ARPA:  inei%uk.ac.glasgow.dcs@nsfnet-relay.ac.uk USENET: inei@cs.glasgow.uucp
  1561. 
  1562. 
  1563. Path: ucivax!gateway
  1564. From: jmunkki@hila.hut.fi (Juri Munkki)
  1565. Subject: DES restrictions
  1566. Message-ID: <199205160658.AA29678@hila.hut.fi>
  1567. Newsgroups: fa.think-c
  1568. Lines: 8
  1569. Date: 16 May 92 06:59:02 GMT
  1570.  
  1571. US regulations can not affect non-US implementations of DES. One of the
  1572. guys who works here at the computing centre has his own implementation
  1573. of DES (a very high quality one too) and he has written a Macintosh version
  1574. of it too (in Think C).
  1575.  
  1576. I forwarded Nick's message to the author.
  1577.  
  1578.     Juri
  1579. 
  1580. 
  1581. Path: ucivax!gateway
  1582. From: s029@brems.ii.uib.no
  1583. Subject: Re: Linking problems...
  1584. Message-ID: <9205161106.AA00211@spinner>
  1585. In-Reply-To: Your message of 15 May 92 00:45:19 +0000.
  1586.              <920514174509.23200b69@AZCC.Arizona.EDU>
  1587. Newsgroups: fa.think-c
  1588. Lines: 23
  1589. Date: 16 May 92 11:07:06 GMT
  1590.  
  1591. Your message dated: 15 May 92 00:45:19 GMT
  1592.  
  1593. >Hi,
  1594. >  I am Mac programming learner, so I am using the book The Macintosh Progamming
  1595. >Primer. (Great book by the way. :))  Anyways, I am doing  one of the programs
  1596. >from the book (PritPICT), and when I try to link it, it tells me that all of the
  1597. >Prxxx functions are undefined.
  1598.  
  1599. >Normally I would say, "Ah ha!  I forgot to include the header file for
  1600. >Printing!", but after examining my code I discovered that it was there.  Iam
  1601. >using Think C version 5.
  1602.  
  1603. A Ha!  The header file includes information that is used at _compile_ time.
  1604. If this was the problem you would find out then.  (Or, depending on your
  1605. compiler settings, you'd just get weird things happening at run time.)
  1606.  
  1607. However, since it's a _linker_ error, you're missing a library.  If I remember
  1608. right (I'm not sure), there's one called PrTraps or something like that.
  1609. Use the Add... command to add it to your project.
  1610.  
  1611. Good luck,
  1612.  
  1613. --Paul Franklin (pdfranklin@ucdavis.edu)
  1614. 
  1615. 
  1616. Path: ucivax!gateway
  1617. From: 91287%TAYLORU@uicvm.uic.edu
  1618. Subject: Animation Problem
  1619. Message-ID: <01GK267Q1HLS8ZE3FL@TAYLORU>
  1620. Newsgroups: fa.think-c
  1621. X-VMS-To: IN%"think-c@ics.uci.edu"
  1622. Lines: 157
  1623. Date: 16 May 92 12:43:11 GMT
  1624. X-Envelope-to: think-c@ics.uci.edu
  1625.  
  1626. This program is my attempt to learn how to program smooth animation, but I am
  1627. having a very strange problem.  The program works fine except that the object
  1628. disapears when the object is above line 120 on the screen.  If anyone can help
  1629. me with this problem, please email me.
  1630.  
  1631. Mark Goddard
  1632. 91287@TAYLORU.BITNET
  1633. 91287@mickey.tayloru.edu
  1634.  
  1635. Here is the code, the CreateOffScreenBitmap was an example in Think Reference:
  1636.  
  1637.  
  1638. #include <Palettes.h>
  1639. #include <Retrace.h>
  1640. #define INTERVAL 1
  1641. #include <Events.h>
  1642. #include <Quickdraw.h>
  1643. #include <Windows.h>
  1644. #include <QDOffScreen.h>
  1645. #define kIsVisible TRUE
  1646. #define kNoGoAway FALSE
  1647. #define kNoWindowStorage 0L
  1648. #define kFrontWindow ((WindowPtr) -1L)
  1649.  
  1650. typedef struct MyTaskElem {
  1651. long myA5; /* 4 bytes before the  VBLTask  data */
  1652. VBLTask myTask;
  1653. } MyTaskElem;
  1654.  
  1655. MyTaskElem taskElem; /* allocate the 18-byte structure */
  1656. WindowPtr       wind;
  1657. PicHandle thePic,backGround,theMask;
  1658. Rect  drawRect,saveRect,sourceRect;
  1659. int dh=1,dv=1;
  1660. GrafPtr maskbit;
  1661. RgnHandle mask;
  1662. GWorldPtr saveBuffer;
  1663. GDHandle windDevice;
  1664. QDErr err;
  1665.  
  1666. void doMyVBL(); /* predefine the function */
  1667. Boolean CreateOffscreenBitMap(GrafPtr *, Rect *);
  1668. void DestroyOffcreenBitMap(GrafPtr);
  1669.  
  1670.  
  1671. main()
  1672. {
  1673.         InitGraf(&thePort);
  1674.         InitWindows();
  1675.  
  1676.         thePic = GetPicture (300);
  1677.         theMask = GetPicture (400);
  1678.         backGround = GetPicture (501);
  1679.         wind = GetNewCWindow (128, nil, (WindowPtr) -1);
  1680.         err = NewGWorld(&saveBuffer, 0, &(wind->portRect), nil, nil, noNewDevice
  1681.    );
  1682.         SetPort(wind);
  1683.         GetGWorld(&wind,&windDevice);
  1684.         SetGWorld(wind,windDevice);
  1685.         DrawPicture(backGround,&((*backGround)->picFrame));
  1686.         sourceRect = ((*thePic)->picFrame);
  1687.         SetGWorld(saveBuffer,nil);
  1688.         LockPixels(GetGWorldPixMap(saveBuffer));
  1689.         DrawPicture(thePic,&sourceRect);
  1690.         UnlockPixels(GetGWorldPixMap(saveBuffer));
  1691.         if (CreateOffscreenBitMap(&maskbit,&((*theMask)->picFrame))) {
  1692.                 SetPort(maskbit);
  1693.                 DrawPicture(theMask,&(*theMask)->picFrame );
  1694.                 }
  1695.         else ExitToShell();
  1696.         SetPort(wind);
  1697.         drawRect = (*thePic)->picFrame;
  1698.         saveRect = (*thePic)->picFrame;
  1699.         OffsetRect(&drawRect,0,0);
  1700.         OffsetRect(&saveRect,0,50);
  1701.         LockPixels(GetGWorldPixMap(saveBuffer));
  1702.         CopyBits(&wind->portBits,*(GetGWorldPixMap(saveBuffer)),&drawRect,&saveR
  1703.    ect,srcCopy,0L);
  1704.  
  1705.         taskElem.myTask.qType =  vType ;
  1706.         taskElem.myTask.vblAddr = doMyVBL; /* address of a task */
  1707.         taskElem.myTask.vblCount = INTERVAL; /* Set the interval */
  1708.         taskElem.myTask.vblPhase = 0;
  1709.         taskElem.myA5 = (long) CurrentA5 ; /* save app's A5 in structure*/
  1710.         if (SlotVInstall(&taskElem.myTask,0)!= 0)
  1711.                 SysBeep(10);
  1712.         while (!Button());
  1713.         UnlockPixels(GetGWorldPixMap(saveBuffer));
  1714.         DestroyOffcreenBitMap(maskbit);
  1715.         SlotVRemove (&taskElem.myTask,0); /* remove your task later */
  1716. }
  1717.  
  1718.  
  1719. /* ============= the VBL task code itself  =============*/
  1720. void doMyVBL()
  1721. {
  1722. GrafPtr savePort;
  1723. asm { move.l A5, -(SP) /* save current value of A5 */
  1724. move.l -4(A0), A5 } /* read app A5 from structure */
  1725. if ((drawRect.right > 400) || (drawRect.left < 0)) dh *= -1;
  1726. if ((drawRect.bottom > 400) || (drawRect.top < 0)) dv *= -1;
  1727. CopyBits(*(GetGWorldPixMap(saveBuffer)),&wind->portBits,&saveRect,&drawRect,srcC
  1728.    opy,0L);
  1729. OffsetRect(&drawRect,dh,dv);
  1730. CopyBits(&wind->portBits,*(GetGWorldPixMap(saveBuffer)),&drawRect,&saveRect,srcC
  1731.    opy,0L);
  1732. CopyMask (*(GetGWorldPixMap(saveBuffer)),&maskbit->portBits, &wind->portBits, &s
  1733.    ourceRect, &(maskbit->portRect),&drawRect);
  1734. taskElem.myTask.vblCount = INTERVAL;  /* Reset for next interval */
  1735. asm { move.l  (SP)+, A5 } /* restore value of A5 */
  1736. }
  1737.  
  1738. Boolean CreateOffscreenBitMap(GrafPtr *newOffscreen, Rect *inBounds)
  1739. {
  1740.         GrafPtr savePort;
  1741.         GrafPtr newPort;
  1742.         GetPort(&savePort); /* need this to restore thePort after OpenPort */
  1743.         newPort = (GrafPtr)NewPtr(sizeof(GrafPort));  /* allocate the grafPort *
  1744.    /
  1745.         if(MemError() != noErr)
  1746.                 return FALSE;
  1747.         OpenPort(newPort);
  1748.         /* make bitmap the size of the bounds that caller supplied */
  1749.         newPort->portRect = *inBounds;
  1750.         newPort->portBits.bounds = *inBounds;
  1751.         RectRgn(newPort->clipRgn, inBounds);
  1752.         RectRgn(newPort->visRgn, inBounds);
  1753.         /* rowBytes is size of row, must be rounded up to an even number of byte
  1754.    s */
  1755.         newPort->portBits.rowBytes =
  1756.         ((inBounds->right - inBounds->left + 15) >> 4) << 1;
  1757.         /* number of bytes in BitMap is rowBytes * number of rows */
  1758.         /* see notes at end of example about using NewPtr instead of NewHandle *
  1759.    /
  1760.         newPort->portBits.baseAddr =
  1761.         NewPtr(newPort->portBits.rowBytes * ( long )(inBounds->bottom -
  1762.         inBounds->top));
  1763.         if(MemError() != noErr)
  1764.         {
  1765.                 SetPort(savePort);
  1766.                 ClosePort(newPort); /* dump the visRgn and clipRgn */
  1767.                 DisposPtr((Ptr)newPort); /* dump the GrafPort */
  1768.                 return FALSE; /* tell caller we failed */
  1769.         }
  1770.         /* since the bits are just memory, let's clear them before we start */
  1771.         EraseRect(inBounds);/* OpenPort did a SetPort(newPort) so we are OK*/
  1772.         *newOffscreen = newPort;
  1773.         SetPort(savePort);
  1774.         return TRUE; /* success */
  1775. }
  1776.  
  1777. void DestroyOffcreenBitMap(GrafPtr oldOffscreen)
  1778. {
  1779.         ClosePort(oldOffscreen); /* dump the visRgn and clipRgn */
  1780.         DisposPtr(oldOffscreen->portBits.baseAddr); /* dump the bits */
  1781.         DisposPtr((Ptr)oldOffscreen); /* dump the port */
  1782. }
  1783. 
  1784. 
  1785. Path: ucivax!gateway
  1786. From: bobm@imagine.convex.com (Bob Miller)
  1787. Subject: Re:  Animation Problem
  1788. Message-ID: <9205161406.AA24298@Mr_Grape.convex.com>
  1789. Newsgroups: fa.think-c
  1790. Lines: 24
  1791. Date: 16 May 92 14:07:22 GMT
  1792.  
  1793. > This program is my attempt to learn how to program smooth animation, but I am
  1794. > having a very strange problem.  The program works fine except that the object
  1795. > disapears when the object is above line 120 on the screen.  If anyone can help
  1796. > me with this problem, please email me.
  1797.  
  1798. The problem is that it takes your program nonzero time to save part of
  1799. the background.  It takes about as long as it takes the video hardware to
  1800. refresh the first 120 screen lines.
  1801.  
  1802. I suggest you use TWO offscreen bitmaps.  Build the composite image
  1803. in the second bitmap, then copy from it to the screen.  Save and
  1804. restore the saverect in the second bitmap, but never save/restore
  1805. anything on the screen.
  1806.  
  1807. That way, there's always a copy of the foreground picture on the
  1808. screen.  While lines above 120 are being refreshed, it's the
  1809. picture from the previous frame instead of the current one,
  1810. but in most cases that isn't too objectionable.
  1811.  
  1812. As a general rule, it doesn't work to use the screen to store bitmaps.
  1813. What if part of the window is obscured by another window?
  1814. Then the pixels "behind" that window would be gone forever.
  1815.  
  1816.                     K<bob>
  1817. 
  1818. 
  1819. Path: ucivax!gateway
  1820. From: kent_sandvik@gateway.qm.apple.com (Kent Sandvik)
  1821. Subject: Re: Re- '040 cache flush
  1822. Message-ID: <9205162230.AA14167@internal.apple.com>
  1823. Newsgroups: fa.think-c
  1824. Lines: 9
  1825. Date: 16 May 92 22:35:09 GMT
  1826.  
  1827.                            RE>Re: '040 cache flush
  1828. Tech Note 261 is a useful one concerning caching issues and coding.
  1829.  
  1830. Cheers,
  1831. Kent/DTS
  1832.  
  1833.  
  1834.       Caffeine
  1835.  
  1836. 
  1837. 
  1838. Path: ucivax!gateway
  1839. From: swenson%john.Berkeley.EDU@ucbvax.berkeley.edu (Kirk Swenson)
  1840. Subject: Re: Animation Problem
  1841. Message-ID: <9205162317.AA28451@john.berkeley.edu>
  1842. Newsgroups: fa.think-c
  1843. Lines: 29
  1844. Date: 17 May 92 17:12:10 GMT
  1845.  
  1846.  
  1847. > This program is my attempt to learn how to program smooth animation, but I am
  1848. > having a very strange problem.  The program works fine except that the object
  1849. > disapears when the object is above line 120 on the screen.
  1850.  
  1851. As Bob Miller points out, the problem is that the first two CopyBits
  1852. to restore and save the background take time.  By the time the code is
  1853. drawing the object, the beam has already passed line 120.  There is
  1854. another potential problem in the code provided, however.
  1855.  
  1856. >void doMyVBL()
  1857. >{
  1858. ...
  1859. >CopyBits(*(GetGWorldPixMap(saveBuffer)),&wind->portBits,&saveRect,&drawRect,srcCopy,0L);
  1860. OffsetRect(&drawRect,dh,dv);
  1861. >CopyBits(&wind->portBits,*(GetGWorldPixMap(saveBuffer)),&drawRect,&saveRect,srcCopy,0L);
  1862. >CopyMask (*(GetGWorldPixMap(saveBuffer)),&maskbit->portBits, &wind->portBits, &sourceRect, &(maskbit->portRect),&drawRect);
  1863. ...
  1864. >}
  1865.  
  1866. CopyBits and CopyMask are both routines that may make Memory Manager
  1867. calls, therefore they cannot safely be called at interrupt time.  Your
  1868. VBL routine should set a global flag, which your application can then
  1869. poll to determine when it is time to draw.
  1870.  
  1871. Kirk Swenson
  1872. UC Berkeley
  1873. swenson@john.berkeley.edu
  1874.  
  1875. 
  1876. 
  1877. Path: ucivax!gateway
  1878. From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
  1879. Subject: Re: Linking problems...
  1880. Message-ID: <920516152811.2200279c@AZCC.Arizona.EDU>
  1881. Newsgroups: fa.think-c
  1882. Lines: 13
  1883. Date: 19 May 92 13:18:59 GMT
  1884. X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
  1885.  
  1886. The file needed would be PrGlue. :)  I also found that if I want to use the
  1887. print manager, I should include PrintTraps.h instead of Printing.h and PrGlue.
  1888.  
  1889. Thanks for the input.
  1890.  
  1891. Mike.
  1892.  
  1893. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1894. Mike Ruhl
  1895. Operator/Mac learner
  1896. Arizona Cancer Center
  1897. mruhl@azcc.arizona.edu
  1898.  
  1899. 
  1900. 
  1901. Path: ucivax!gateway
  1902. From: udsugar@KING.MCS.DREXEL.EDU (David Sugar)
  1903. Subject: Hmm..
  1904. Message-ID: <9205210017.AA13234@mcs.drexel.edu>
  1905. Newsgroups: fa.think-c
  1906. Lines: 11
  1907. Date: 21 May 92 00:21:18 GMT
  1908.  
  1909.  
  1910.   I havn't noticed much activity on this mailing list recently.  It seems
  1911. that once the tcl list formed many people have moved over there.  But, I
  1912. have a quesiton, unfortunilty it isn't a C question.  I just need to
  1913. know at what address I can mail Symantec because I have a possible bug
  1914. to report in Think Pascal..
  1915.  
  1916.   Dave Sugar
  1917.  
  1918.   udsugar@mcs.drexel.edu
  1919.  
  1920. 
  1921. 
  1922. Path: ucivax!gateway
  1923. From: iom@dsunx1.dsrd.ornl.gov (MIKOLIC-TORREI I)
  1924. Subject: Address for Symantec
  1925. Message-ID: <9205210320.AA15243@dsunx1.DSRD.ORNL.GOV>
  1926. Newsgroups: fa.think-c
  1927. Lines: 22
  1928. Date: 21 May 92 03:20:43 GMT
  1929.  
  1930.  
  1931. Dave,
  1932.  
  1933. Symantec's address is:
  1934.  
  1935. Symantec Corporation
  1936. 10201 Torre Avenue
  1937. Cupertino, CA 95014
  1938.  
  1939. (408) 253-9600
  1940.  
  1941. Might I suggest that the best place for a bug report is the Symantec
  1942. area on CompuServe.  I've always had _excellent_ response when I posted
  1943. specific issues/questions there.  The only draw back is the $$$$.
  1944.  
  1945. I've also noticed that this list is a bit quiet lately--I doubt it's because
  1946. people moved to the TCL list.  I suscribe to both and that one's pretty
  1947. quiet recently too (although not quite as quiet as this one).
  1948.  
  1949. Igor Mikolic-Torreira
  1950. iom@dsunx1.dsrd.ornl.gov
  1951.  
  1952. 
  1953. 
  1954. Path: ucivax!gateway
  1955. From: king@acpub.duke.edu (King Rhoton)
  1956. Subject: Symantec
  1957. Message-ID: <9205211237.AA15772@raphael.acpub.duke.edu>
  1958. Newsgroups: fa.think-c
  1959. Lines: 4
  1960. Date: 21 May 92 12:38:06 GMT
  1961.  
  1962. You can also leave bug reports/messages to Symantec on their BBS (if you don't
  1963. have access to Compuserve).  For 2400 baud, call (408)973-9598.  For 9600
  1964. and higher, call (408)973-9856.
  1965. King
  1966. 
  1967. 
  1968. Path: ucivax!gateway
  1969. From: king@acpub.duke.edu (King Rhoton)
  1970. Subject: MapRect
  1971. Message-ID: <9205211242.AA15809@raphael.acpub.duke.edu>
  1972. Newsgroups: fa.think-c
  1973. Lines: 6
  1974. Date: 21 May 92 12:42:20 GMT
  1975.  
  1976. So, does anyone out there have any ideas about why I'm having the following
  1977. problem?  Specifically, I'm trying to resize a 320x240 graphic into a
  1978. window for display.  For window sizes up to 160x120, everything works fine.
  1979. However, for any window size large, all I get is the upper left area of the
  1980. full-size graphic.  Any ideas would be appreciated.
  1981. King
  1982. 
  1983. 
  1984. Path: ucivax!gateway
  1985. From: 91287%TAYLORU@uicvm.uic.edu
  1986. Subject: (none)
  1987. Message-ID: <01GK9LGCWT688ZEBHH@TAYLORU>
  1988. Newsgroups: fa.think-c
  1989. X-VMS-To: IN%"tcl-talk@brown.edu",IN%"think-c@ics.uci.edu"
  1990. Lines: 1
  1991. Date: 21 May 92 13:08:38 GMT
  1992. X-Envelope-to: think-c@ics.uci.edu
  1993.  
  1994. Please remove me from this list.
  1995. 
  1996. 
  1997. Path: ucivax!gateway
  1998. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  1999. Subject: Hmm..
  2000. Message-ID: <9205211310.AA24345@chaos.cs.brandeis.edu>
  2001. In-Reply-To: David Sugar's message of 21 May 92 00:21:18 GMT <9205210017.AA13234@mcs.drexel.edu>
  2002. Newsgroups: fa.think-c
  2003. Lines: 16
  2004. Date: 21 May 92 13:10:25 GMT
  2005.  
  2006. >>>>> On 21 May 92 00:21:18 GMT, David Sugar <udsugar@king.mcs.drexel.edu> said:
  2007.  
  2008.  > I just need to know at what address I can mail Symantec because I
  2009.  > have a possible bug to report in Think Pascal..
  2010.  
  2011. You can (and should) email bugs regarding THINK C and THINK Pascal to
  2012. either D0152@AppleLink.apple.com, or 76666.2005@CompuServe.com. Our
  2013. Tech Support staff makes it a point to reply to messages that are
  2014. gatewayed from the Internet to AppleLink and CIS, since we (at
  2015. present) do not have a direct Internet connection.
  2016.  
  2017.     -phil
  2018. ----
  2019.    Phil Shapiro                                   Software Engineer
  2020.    Language Products Group                     Symantec Corporation
  2021.            Internet: phils@cs.brandeis.edu
  2022. 
  2023. 
  2024. Path: ucivax!gateway
  2025. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2026. Subject: Address for Symantec
  2027. Message-ID: <9205211313.AA24388@chaos.cs.brandeis.edu>
  2028. In-Reply-To: MIKOLIC-TORREI I's message of 21 May 92 03:20:43 GMT <9205210320.AA15243@dsunx1.DSRD.ORNL.GOV>
  2029. Newsgroups: fa.think-c
  2030. Lines: 27
  2031. Date: 21 May 92 13:13:35 GMT
  2032.  
  2033. >>>>> On 21 May 92 03:20:43 GMT, MIKOLIC-TORREI I <iom@dsunx1.dsrd.ornl.gov> said:
  2034.  > Symantec's address is:
  2035.  
  2036.  > Symantec Corporation
  2037.  > 10201 Torre Avenue
  2038.  > Cupertino, CA 95014
  2039.  
  2040.  > (408) 253-9600
  2041.  
  2042. This is the address and phone number for Symantec's main office. To
  2043. reach the THINK Tech Support gurus, you should use this address
  2044. instead:
  2045.  
  2046. Symantec Corp
  2047. 135 South Road
  2048. Bedford, MA 01730
  2049.  
  2050. (617) 275-4800 (voice)
  2051. (617) 275-2124 (FAX)
  2052.  
  2053. If you FAX, keep the source listing down to a page or two of code.
  2054.  
  2055.     -phil
  2056. ----
  2057.    Phil Shapiro                                   Software Engineer
  2058.    Language Products Group                     Symantec Corporation
  2059.            Internet: phils@cs.brandeis.edu
  2060. 
  2061. 
  2062. Path: ucivax!gateway
  2063. From: REXB@vm.cc.purdue.edu (Rex Bontrager)
  2064. Subject: Re: Address for Symantec
  2065. Message-ID: <9205210848.aa11270@q2.ics.uci.edu>
  2066. In-Reply-To: Your message of 21 May 92 03:20:43 GMT
  2067. Newsgroups: fa.think-c
  2068. Lines: 16
  2069. Date: 21 May 92 15:48:32 GMT
  2070.  
  2071. On 21 May 92 03:20:43 GMT you said:
  2072. >Might I suggest that the best place for a bug report is the Symantec
  2073. >area on CompuServe.  I've always had _excellent_ response when I posted
  2074. >specific issues/questions there.  The only draw back is the $$$$.
  2075.  
  2076. Do you know Symantec's Compuserve id; i.e., of the form nnnnn,nnnn?
  2077. Internet and Bitnet people can correspond with Compuserve accounts if
  2078. we know the numeric id.
  2079.  
  2080.  
  2081. Rex Bontrager
  2082. IBM Systems Programmer, IBM Postmaster
  2083. Purdue University Computing Center
  2084. Bitnet:    rexb@purccvm
  2085. Internet:  rexb@vm.cc.purdue.edu
  2086. Phone:     (317) 494-1787 ext. 256
  2087. 
  2088. 
  2089. Path: ucivax!gateway
  2090. From: leone@ohsu.edu (TJ Leone)
  2091. Subject: Apple Event Object Support Library
  2092. Message-ID: <9205211551.AA21442@rainier.ohsu.edu>
  2093. Newsgroups: fa.think-c
  2094. Lines: 10
  2095. Date: 21 May 92 15:48:39 GMT
  2096.  
  2097. Is there a THINK C version of the Apple Event Support Library available via ftp?  apda
  2098. Developer's CD?  anyplace else?
  2099.  
  2100. Thanks,
  2101.  
  2102. TJ Leone, Research Associate
  2103. Biomedical Information Communication Center
  2104. Oregon Health Sciences University
  2105.  
  2106. leone@ohsu.edu
  2107. 
  2108. 
  2109. Path: ucivax!gateway
  2110. From: rush@mnementh.metaphor.com (Ed Rush)
  2111. Subject: Re:  Address for Symantec
  2112. Message-ID: <9205211647.AA22389@mnementh.Metaphor.COM>
  2113. Newsgroups: fa.think-c
  2114. Lines: 12
  2115. Date: 21 May 92 16:46:15 GMT
  2116.  
  2117. >Might I suggest that the best place for a bug report is the Symantec
  2118. >area on CompuServe.
  2119.  
  2120. Don't forget that Symantec also runs its own BBS. The telephone
  2121. number is in the manual (which I do not have handy right now).
  2122.   -----------------------------------------
  2123.   Ed Rush, employed by but not speaking for
  2124.   Metaphor Computers, Mtn. View, CA
  2125.      UUCP: [...!{apple|decwrl}!]metaphor!rush
  2126.      Internet: rush@metaphor.com
  2127.   -----------------------------------------
  2128. Calm down, everyone, it's only ones and zeroes.
  2129. 
  2130. 
  2131. Path: ucivax!gateway
  2132. From: gerhard@rana.usc.edu
  2133. Subject: List
  2134. Message-ID: <9205211824.AA12156@mizar.usc.edu>
  2135. Newsgroups: fa.think-c
  2136. Lines: 3
  2137. Date: 21 May 92 18:25:10 GMT
  2138.  
  2139. Please remove me from the list.
  2140. Peter Gerhardstein (gerhard@rana.usc.edu)
  2141.  
  2142. 
  2143. 
  2144. Path: ucivax!gateway
  2145. From: nate@garnet.berkeley.edu (Nathaniel Titterton)
  2146. Subject: making MPW format object files...
  2147. Message-ID: <9205212235.AA18741@garnet.berkeley.edu>
  2148. X-Mailer: ELM [version 2.3 PL11]
  2149. Newsgroups: fa.think-c
  2150. Lines: 16
  2151. Date: 21 May 92 22:35:44 GMT
  2152.  
  2153.  
  2154. I am using MCL2.0 (Macintosh Common Lisp) and want to use its
  2155. foreign function capabilities.  However, it requires an object
  2156. file in MPW format, which of course, think-c can't really make.
  2157. In talking to Symantec, they said that I could use ThinkPascal
  2158. as an intermediary, having it read in a think-c library and then
  2159. write out a MPW compatable library (which it automatically does).
  2160.    Well, I haven't got this to work...  Does anyone have any
  2161. experience with this?  Is that fact that I am using Pascal 3.0
  2162. to blame (Symantec says probably not).  What other libraries
  2163. should I include in the pascal library, if any (it automagically
  2164. puts some there...)?  Sheesh.
  2165.  
  2166. Thanks a lot for any help...
  2167.  
  2168. -nate
  2169. 
  2170. 
  2171. Path: ucivax!gateway
  2172. From: siegel@world.std.com (Rich Siegel)
  2173. Subject: Re:  making MPW format object files...
  2174. Message-ID: <9205220035.AA16891@world.std.com>
  2175. Newsgroups: fa.think-c
  2176. Lines: 9
  2177. Date: 22 May 92 00:36:13 GMT
  2178.  
  2179. It's probably not necessary to add any of THINK Pascal's own libraries
  2180. to the project to build your .O file, unless some of the code is in
  2181. Pascal. Otherwise, there's no reason you can't use THINK Pascal as
  2182. a mechanism for translating THINK C libraries into .O files.
  2183.  
  2184. Since you didn't give any specific information on why it doesn't
  2185. work, it's pretty difficult to offer useful assistance.
  2186.  
  2187. R.
  2188. 
  2189. 
  2190. Path: ucivax!gateway
  2191. From: NOHL@ccit.arizona.edu
  2192. Subject: please remove me from the list
  2193. Message-ID: <01GKA754X2IO8Y6WW5@CCIT.ARIZONA.EDU>
  2194. Newsgroups: fa.think-c
  2195. X-VMS-To: IN%"think-c@ics.uci.edu"
  2196. Lines: 1
  2197. Date: 22 May 92 01:27:17 GMT
  2198. X-Envelope-to: think-c@ics.uci.edu
  2199.  
  2200. please remove me from the list.  bye
  2201. 
  2202. 
  2203. Path: ucivax!gateway
  2204. From: siegel@world.std.com (Rich Siegel)
  2205. Subject: Re:  making MPW format object files...
  2206. Message-ID: <9205220149.AA23322@world.std.com>
  2207. Newsgroups: fa.think-c
  2208. Lines: 7
  2209. Date: 22 May 92 01:49:56 GMT
  2210.  
  2211. After using DumpObj to dump the .O file, it becomes clear that THINK Pascal
  2212. uppercases the entry-point name, so try using 'DEFFCFUN' instead, if MCL
  2213. is case-sensitive (which it probably is, in this case).
  2214.  
  2215. This is reasonable behavior, because names are case-insensitive in Pascal.
  2216.  
  2217. R.
  2218. 
  2219. 
  2220. Path: ucivax!gateway
  2221. From: hong@mbfys.kun.nl (Hong Zhou)
  2222. Subject: sign off
  2223. Message-ID: <9205220955.AA22821@augustus.mbfys.kun.nl>
  2224. Newsgroups: fa.think-c
  2225. Lines: 1
  2226. Date: 22 May 92 07:58:32 GMT
  2227.  
  2228. unsubscribe think-c
  2229. 
  2230. 
  2231. Path: ucivax!gateway
  2232. From: osc!vincent@ames.arc.nasa.gov (Vincent Tong)
  2233. Subject: please remove me from the list
  2234. Message-ID: <9205221729.AA17459@osc.com>
  2235. Newsgroups: fa.think-c
  2236. Lines: 6
  2237. Date: 22 May 92 18:08:38 GMT
  2238.  
  2239.  
  2240. please remove me from the list
  2241.  
  2242. Thanks
  2243.  
  2244. Vincent
  2245. 
  2246. 
  2247. Path: ucivax!gateway
  2248. From: garl@nlm.nih.gov (Gary Letourneau)
  2249. Subject: remove me from think-c list
  2250. Message-ID: <9205221846.AA01878@csb1.nlm.nih.gov>
  2251. Newsgroups: fa.think-c
  2252. Lines: 3
  2253. Date: 22 May 92 18:47:09 GMT
  2254.  
  2255.  
  2256. unsubscribe think-c
  2257.  
  2258. 
  2259. 
  2260. Path: ucivax!gateway
  2261. From: U42641@uicvm.uic.edu (Richard Wolf 6-4527)
  2262. Subject: Everyone who's thinking about unsubscribing and sending E-mail
  2263. Message-ID: <9205221302.aa28762@q2.ics.uci.edu>
  2264. Newsgroups: fa.think-c
  2265. Lines: 18
  2266. Date: 22 May 92 20:02:43 GMT
  2267.  
  2268.           to think-c@ics.uci.edu ...
  2269.  
  2270. The following is for those of you who are thinking about unsubscribing
  2271. to this list and sending your request to think-c@ics.uci.edu.
  2272.  
  2273. Don't !!  If I see another piece of E-mail on this list asking that
  2274. someone be unsubscribed, I think I'm gonna go nuts!
  2275.  
  2276. Send your reguests ... drum roll please ... to ...
  2277.  
  2278.      think-c-request@ics.uci.edu
  2279.  
  2280. How you can get as far as programming the Mac in C and yet not be able to
  2281. follow this simple rule really amazes me.  After all, it's not as though
  2282. this list were somehow the exception to the general rule.  When you
  2283. subscribed to this list, you were sent instructions on how to do take
  2284. care of official requests, such as unsubscribing.
  2285.  
  2286. 
  2287. 
  2288. Path: ucivax!gateway
  2289. From: rush@mnementh.metaphor.com (Ed Rush)
  2290. Subject: How to leave the think-c list
  2291. Message-ID: <9205222114.AA22912@mnementh.Metaphor.COM>
  2292. Newsgroups: fa.think-c
  2293. Lines: 7
  2294. Date: 22 May 92 21:13:20 GMT
  2295.  
  2296. Mailboxes everywhere are being cluttered with people trying to
  2297. leave the Think C mailing list.  PLEASE, if you want to
  2298. unsubscribe, send the word to:
  2299.  
  2300. think-c-request@ics.uci.edu
  2301.  
  2302. DO NOT send it to the list at large.
  2303. 
  2304. 
  2305. Path: ucivax!gateway
  2306. From: jeffp@brspyr1.brs.com ("Jeffrey S. Pace")
  2307. Subject: please remove me ...
  2308. Message-ID: <9205221206.AA21857@brspyr1.BRS.Com>
  2309. X-Mailer: ELM [version 2.2 PL16]
  2310. Newsgroups: fa.think-c
  2311. Lines: 13
  2312. Date: 23 May 92 02:34:35 GMT
  2313.  
  2314.  
  2315. Please remove me from your list.
  2316.  
  2317. --
  2318.  
  2319.                          /////////////////////////
  2320.  ///////////////////////+-----------------------+/
  2321. +-----------------------+ BRS Software Products |///////////////////////////////
  2322. |    Jeffrey S. Pace    |     1200 Route 7    +-----------------------------+/
  2323. +-----------------------+   Latham, N.Y. 12110  | ARPA: jeffp@brspyr1.BRS.Com |/
  2324.             +-----------------------+                  |/
  2325.    Hey Moe ...                |  UUCP: uunet!crdgw1!brspyr1!jeffp   |/
  2326.     -Curly Howard            +-------------------------------------+
  2327. 
  2328. 
  2329. Path: ucivax!gateway
  2330. From: gt0657c@prism.gatech.edu (geoff george)
  2331. Subject: Think C 5.0.2 vs. TMON Pro 3.0
  2332. Message-ID: <9205230518.AA09151@prism.gatech.edu>
  2333. Newsgroups: fa.think-c
  2334. Lines: 20
  2335. Date: 23 May 92 05:18:05 GMT
  2336.  
  2337. The TC5 docs say (p. 245) that TMON's V variable will be set to the value
  2338. of the application's program counter when TMON (2.8.x) is invoked from
  2339. the TC debugger via the Monitor command. This doesn't appear to work for
  2340. TMON Pro 3.0, using TC 5.0.2. Am I missing something?
  2341.  
  2342. What I want to do is turn on Discipline inside TMON, then step through
  2343. my code with the TC debugger waiting for Discipline to invoke TMON, to
  2344. effectively get Discipline to interact with the TC debugger. Is there
  2345. a better way to do this? Is there a later TMON or TC debugger?
  2346.  
  2347.  
  2348. geoff
  2349. 5/23/92
  2350.  
  2351. --
  2352. geoff george    geoff@cc.gatech.edu        (my name)
  2353.         or    gt0657c@prism.gatech.edu   (personal warmth from GaTech OCS)
  2354.  
  2355. "Ordinary f---ing people - I hate 'em. Ordinary person spends his life avoiding
  2356. tense situations; repo man spends his life getting INTO tense situations."
  2357. 
  2358. 
  2359. Path: ucivax!gateway
  2360. From: idowell@bbn.com
  2361. Subject: Re: please remove me ...
  2362. Message-ID: <9205222221.aa07815@q2.ics.uci.edu>
  2363. In-reply-to: Your message of 23 May 92 02:34:35 +0000.
  2364.              <9205221206.AA21857@brspyr1.BRS.Com>
  2365. Newsgroups: fa.think-c
  2366. Lines: 4
  2367. Date: 23 May 92 05:21:58 GMT
  2368.  
  2369. Perhaps everyone on the list should reply to this type of message
  2370. and people will start using "request"?  1/2 :-)
  2371.  
  2372. Ian
  2373. 
  2374. 
  2375. Path: ucivax!gateway
  2376. From: gt0657c@prism.gatech.edu (geoff george)
  2377. Subject: Think C 5.0.2 vs. TMON Pro 3.0 reprise
  2378. Message-ID: <9205231941.AA18665@prism.gatech.edu>
  2379. Newsgroups: fa.think-c
  2380. Lines: 21
  2381. Date: 23 May 92 19:41:45 GMT
  2382.  
  2383. If I drop from the TC debugger into TMON via the Monitor command, how
  2384. can I find out the current value of my application's PC?
  2385.  
  2386. Also, why does the TC debugger report different addresses for functions
  2387. than does TMON? For example (I just checked) "& main" is reported by
  2388. the TC debugger to be 0x25BCE2 when TMON says it's $0019986A. When the
  2389. TC debugger reports that an error happened at some address, does it give
  2390. the correct address?
  2391.  
  2392. I'm running system 7.0 with the Tune-Up 1.1.1, on a Mac II with 5MB,
  2393. with Mode32 disabled.
  2394.  
  2395. geoff
  2396. 5/23/92
  2397.  
  2398. --
  2399. geoff george    geoff@cc.gatech.edu        (my name)
  2400.         or    gt0657c@prism.gatech.edu   (personal warmth from GaTech OCS)
  2401.  
  2402. "Ordinary f---ing people - I hate 'em. Ordinary person spends his life avoiding
  2403. tense situations; repo man spends his life getting INTO tense situations."
  2404. 
  2405. 
  2406. Path: ucivax!gateway
  2407. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2408. Subject: Think C 5.0.2 vs. TMON Pro 3.0 reprise
  2409. Message-ID: <9205241511.AA15873@chaos.cs.brandeis.edu>
  2410. In-Reply-To: geoff george's message of 23 May 92 19:41:45 GMT <9205231941.AA18665@prism.gatech.edu>
  2411. Newsgroups: fa.think-c
  2412. Lines: 40
  2413. Date: 24 May 92 15:14:23 GMT
  2414.  
  2415. >>>>> On 23 May 92 19:41:45 GMT, geoff george <gt0657c@prism.gatech.edu> said:
  2416.  
  2417.  > If I drop from the TC debugger into TMON via the Monitor command,
  2418.  > how can I find out the current value of my application's PC?
  2419.  
  2420. You'll have the use the technique described in the "other debuggers"
  2421. section -- the current PC is located at (PC-4)^. You can probably
  2422. write a macro for TMON Pro to simplify this.
  2423.  
  2424.  > Also, why does the TC debugger report different addresses for
  2425.  > functions than does TMON? For example (I just checked) "& main" is
  2426.  > reported by the TC debugger to be 0x25BCE2 when TMON says it's
  2427.  > $0019986A. When the TC debugger reports that an error happened at
  2428.  > some address, does it give the correct address?
  2429.  
  2430. This is actually a pretty interesting problem. The answer is that it's
  2431. because the expressions in the data window are evaluated as if they
  2432. appear in the code stream in your program. There isn't any expression
  2433. evaluator; the compiler itself is used to generate code for data
  2434. window expressions.
  2435.  
  2436. So, if you take the address of a function, you get the same result as
  2437. if you took its address in you program; you get its jump table entry.
  2438. There's actually a bug in the debugger where if you try and display
  2439. the address of a static function, you'll get a fake jump table entry.
  2440. PC-relative addresses for static functions aren't generated by the
  2441. compiler, but by the linker.
  2442.  
  2443. Given that you have the address of the jump table entry, and given
  2444. that it's a loaded entry, you can probaby use an expression like:
  2445.  
  2446.     *(Ptr *)((char *)&main + 4) // should return "real" address of main
  2447.  
  2448. (off the top of my head, no guarantees)
  2449.  
  2450.     -phil
  2451. ----
  2452.    Phil Shapiro                                   Software Engineer
  2453.    Language Products Group                     Symantec Corporation
  2454.            Internet: phils@cs.brandeis.edu
  2455. 
  2456. 
  2457. Path: ucivax!gateway
  2458. From: igorl@uiuc.edu (Igor Livshits)
  2459. Subject: Screwy menu hook
  2460. Message-ID: <9205241816.AA24797@newton.ncsa.uiuc.edu>
  2461. Newsgroups: fa.think-c
  2462. Lines: 26
  2463. Date: 24 May 92 18:16:22 GMT
  2464.  
  2465. Hello,
  2466.  
  2467. I am having some problems with the menu hook to accommodate the extra width
  2468. of the down arrow in a popup menu.  I have a dialog with a list box where
  2469. one may add elements.  Each element has its own popup menu that I swap in
  2470. and out of the same pane as an item is selected.  This works great as long
  2471. as I have only one (CBartender has to load and add the menu) of each
  2472. elements (therefore, every menu is used just once).
  2473.  
  2474. This breaks down once a second instance of the same element is added
  2475. (CBartender already has the menu).  Now, two separate objects are trying to
  2476. share the same menu handle.  The hook screws up the menu width and
  2477. itsMenu->GetWidth() returns -1.
  2478.  
  2479. Once I close and dispose of the dialog and invoke a brand new one
  2480. (CBartender already has the menu), all menus will work fine, but everything
  2481. is as though the hook never existed!
  2482.  
  2483. Any suggestions?  I will send source code if anyone would like to take a
  2484. look at it.
  2485.  
  2486. Everything is dandy if I never bother with the hook.
  2487.  
  2488.  
  2489. Thanks, Igor
  2490.  
  2491. 
  2492. 
  2493. Path: ucivax!gateway
  2494. From: R.Pugmire@massey.ac.nz
  2495. Subject: Mixing Pascal and C
  2496. Message-ID: <920525162930.20200127@pt-cluster.massey.ac.nz>
  2497. Newsgroups: fa.think-c
  2498. Lines: 12
  2499. Date: 25 May 92 04:29:58 GMT
  2500. X-Vmsmail-To: EMAIL"think-c@ics.uci.edu"
  2501.  
  2502. I'm having a problem mixing Pascal and C. Why would anyone want to? Well..
  2503.  
  2504. I need to add some routines (written in think C) to an application written in
  2505. Think Pascal. So I wrote the routines in think C saved them as a library
  2506. and loaded them into the pascal project. No problems. Until I needed to use
  2507. the c library routines. I either get messages that the routines are not
  2508. defined at link time in pascal. OR multiply defined if  I include the
  2509. libraries into think c before saving as a library. Any suggestions on how
  2510. this should be handled.
  2511.  
  2512. Ralph Pugmire, Massey University, New Zealand.
  2513. R.Pugmire@massey.ac.nz
  2514. 
  2515. 
  2516. Path: ucivax!gateway
  2517. From: bjohnson@occs.cs.oberlin.edu (Bruce Johnson)
  2518. Subject: Removal from list
  2519. Message-ID: <9205250532.AA28896@occs.cs.oberlin.edu>
  2520. Newsgroups: fa.think-c
  2521. Lines: 5
  2522. Date: 25 May 92 05:33:35 GMT
  2523.  
  2524.  
  2525. Please remove my name from the think-c mailing list
  2526.  
  2527. Bruce Johnson
  2528. bjohnson@occs.cs.oberlin.edu
  2529. 
  2530. 
  2531. Path: ucivax!gateway
  2532. From: laborde@imag.fr (Jean-Marie Laborde)
  2533. Subject: Strange Bug?
  2534. Message-ID: <9205251606.AA11342@imag.imag.fr>
  2535. Newsgroups: fa.think-c
  2536. Lines: 59
  2537. Date: 25 May 92 16:07:46 GMT
  2538.  
  2539. Rewriting the code for removing unwanted resources for the program Cabri-geometre, I encoutered the following strange bug:
  2540. (The code has been made as small as possible)
  2541.  
  2542. /*************************************/
  2543. #include <MacHeaders>
  2544. #include <stdlib.h>
  2545. #include <stdio.h>
  2546.  
  2547. int       pathRefNum,
  2548.           sauve_pathRefNum,
  2549.        number;
  2550. char   essai[8]="1 2 3 4",
  2551.           *carPtr=&essai[0];
  2552.  
  2553. void main(void)
  2554. {
  2555. /* standard initilizations: */
  2556.            InitGraf(&thePort);
  2557.         InitWindows();
  2558.            InitMenus();
  2559.            InitFonts();
  2560.            InitDialogs(0L);
  2561.            InitCursor();
  2562.            TEInit();
  2563.  
  2564.            OpenResFile("\pApplic");
  2565.  
  2566. // the bug:
  2567.     number=atoi(carPtr);
  2568.            printf("val= %d \n",number);
  2569.            while (!Button());
  2570. }
  2571. /*************************************/
  2572.  
  2573. Librairies are ANSI and MacTraps.
  2574. It must exist a file named "Applic" at the same level as the project.
  2575. There no BUG when the cooresponding code is build in an Application.
  2576.  
  2577. There is a bug (the Mac freeze very severely) under Think_C5 with or without the Debugger option.
  2578. The BUG is at least on a Qudra 900, a Ci, a IIfx  or a SE30 (freezes less severely).
  2579.  
  2580. The BUG does not occur if you call atoi() a first time before OpenResFile().
  2581. The BUG does not occur if you have a file "Applic" with no Code ressource, but
  2582.         it comes when certain Code ressource are present, as in an appliction
  2583.         mostly empty build using the simplest possible code      main(){}
  2584.         and ThinkC5.
  2585.         This gives an apllication with 3 CODE resources. You should
  2586.         then duplicate the CODE having ID 2 (6 bytes long) and give it the ID 5.
  2587.         (It seems it's important that there is a code with ID 5 to provoque the
  2588.         BUG)
  2589.  
  2590. The BUG does not occur when using ThinkC4.0 (IIfx) and adapting the code
  2591.         accordingly.
  2592.  
  2593. I use System 7.01 (US and France) and I dont know the situation under System 6.x.
  2594.  
  2595. Thank you for helping.
  2596.  
  2597.  
  2598. 
  2599. 
  2600. Path: ucivax!gateway
  2601. From: siegel@world.std.com (Rich Siegel)
  2602. Subject: 'unsubscribe' noise
  2603. Message-ID: <9205251736.AA05725@world.std.com>
  2604. Newsgroups: fa.think-c
  2605. Lines: 17
  2606. Date: 25 May 92 17:36:52 GMT
  2607.  
  2608.  
  2609. It seems that many people know to mail to think-c-request to subscribe,
  2610. but to unsubscribe, they always seem to mail to think-c, with the results
  2611. we all know about.
  2612.  
  2613. The course of action I suggest is this: if an unsubscribe request goes out
  2614. to the general list, it will not be acted upon, and the readers of the list
  2615. (or some subset thereof) will send a message to the originator advising him
  2616. that administrative requests should go to think-c-request, not to think-c.
  2617. This has two benefits: novices reading the list (and considering unsubscribing)
  2618. will be repeatedly reminded of the correct mechanism, and the person who
  2619. asked to unsubscribe will (hopefully) get the message and use the correct
  2620. mechanism.
  2621.  
  2622. Feedback and refinements are welcome.
  2623.  
  2624. R.
  2625. 
  2626. 
  2627. Path: ucivax!gateway
  2628. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2629. Subject: Mixing Pascal and C
  2630. Message-ID: <9205251439.AA25859@chaos.cs.brandeis.edu>
  2631. In-Reply-To: R.Pugmire@massey.ac.nz's message of 25 May 92 04:29:58 GMT <920525162930.20200127@pt-cluster.massey.ac.nz>
  2632. Newsgroups: fa.think-c
  2633. Lines: 24
  2634. Date: 25 May 92 17:49:25 GMT
  2635.  
  2636. >>>>> On 25 May 92 04:29:58 GMT, R.Pugmire@massey.ac.nz said:
  2637.  
  2638.  > I need to add some routines (written in think C) to an application
  2639.  > written in Think Pascal. So I wrote the routines in think C saved
  2640.  > them as a library and loaded them into the pascal project. No
  2641.  > problems. Until I needed to use the c library routines. I either
  2642.  > get messages that the routines are not defined at link time in
  2643.  > pascal. OR multiply defined if I include the libraries into think c
  2644.  > before saving as a library. Any suggestions on how this should be
  2645.  > handled.
  2646.  
  2647. The best solution is to rewrite the THINK C code so that is no longer
  2648. relies on the ANSI library routines. This may or may not be easy, but
  2649. it's a lot easier than getting the ANSI library itself to work inside
  2650. of THINK Pascal. If you need routines like printf() or sprintf(), you
  2651. may be better off writing specific routines in Pascal (eg,
  2652. print_string(), or format_float()), and then calling them from the C
  2653. code.
  2654.  
  2655.     -phil
  2656. ----
  2657.    Phil Shapiro                                   Software Engineer
  2658.    Language Products Group                     Symantec Corporation
  2659.            Internet: phils@cs.brandeis.edu
  2660. 
  2661. 
  2662. Path: ucivax!gateway
  2663. From: adam@igg.tno.nl
  2664. Subject: Where is  fopenw()
  2665. Message-ID: <9205251153.AA05676@iggppserv.igg.tno.nl>
  2666. Newsgroups: fa.think-c
  2667. Lines: 39
  2668. Date: 25 May 92 17:50:15 GMT
  2669. X-Envelope-to: think-c@ics.uci.edu
  2670.  
  2671.  
  2672.  
  2673. Hello all,
  2674.  
  2675. Since some time I am doing some bug-fixing on NET/Mac, a program for HAM-radio
  2676. stations. The sources are Think C 3.0X sources, and therefor (I think) the
  2677. resulting application is not 32 bit clean... Now I figured out, that probably
  2678. the first step to take was 'migrating' the sources to Think C 4.0X, and doing
  2679. so, I discovered that fopenw(), which was available in 3.0X is no longer
  2680. available in 4.0X.
  2681.  
  2682. This means I will have to do a lot of programming in order to get the Think 4
  2683. version to work, since fopenw() is heavily used.
  2684.  
  2685. Can anybody tell me if there is some kind of an interface between the old
  2686. fopenw() call and the newer compiler? If not, some hints maybe?
  2687.  
  2688. Please help me out, I'm stuck...
  2689.  
  2690. Regards,
  2691.   __
  2692.  /_/  _/  _   ___
  2693. / / (_/ (_/ / / /
  2694.  
  2695. (Adam van Gaalen)        phone: (31) 15 - 697283
  2696.  
  2697. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
  2698. | Please send your reply to:                 |Goes to |Mac  |Software  |
  2699. + - - - - - - - - - - - - - - - - - - - - - -+- - - - + - - + - - - - -+
  2700. |   internet:adam@igg.tno.nl                 | office |LC   |NCSATelnet|
  2701. |         or:pa2aga@igg.tno.nl               |  same  |same |   same   |
  2702. |earn/bitnet:gaalen@hdetno51.bitnet          |  same  |same |   same   |
  2703. |  Ham-radio:pa2aga@pa2aga   (44.137.32.9)   |my place|IIx  | NET/Mac  |
  2704. |         or:pa2aga@pa2aga-1 (44.137.32.61)  |  same  |512Ke|   same   |
  2705. |         or:pa2aga@pa2aga-2 (44.137.32.19)  |  same  |512Ke|   same   |
  2706. |         or:pa2aga@pa2aga-10(44.137.32.104) |  same  |PB100|   same   |
  2707. |         or:pa2aga@pi8mac   (44.137.32.22)  |  same  |SE/30|   same   |
  2708. |    Ham BBS:pa2aga@pi8eae.nld.eu            |  same  |any/5|   same   |
  2709. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
  2710. 
  2711. 
  2712. Path: ucivax!gateway
  2713. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2714. Subject: Strange Bug? - segment loader problem
  2715. Message-ID: <9205251944.AA29099@chaos.cs.brandeis.edu>
  2716. In-Reply-To: Jean-Marie Laborde's message of 25 May 92 16:07:46 GMT <9205251606.AA11342@imag.imag.fr>
  2717. Newsgroups: fa.think-c
  2718. Lines: 23
  2719. Date: 25 May 92 19:47:20 GMT
  2720.  
  2721. You're having a problem with the way that the segment loader works.
  2722. The call to atoi() causes the segment that contains the ANSI code to
  2723. be loaded in using the segment loader. Since your code opens up a
  2724. resource file that contains a CODE resource with the same resource ID
  2725. as the one the loader's looking for, it loads the file's CODE resource
  2726. instead. This causes the crash that you're getting, since the file's
  2727. CODE resource is completely different than the one in your
  2728. application.
  2729.  
  2730. It doesn't occur if you call atoi() first since the segment loading
  2731. has already occurred; the ANSI code segment has already been loaded,
  2732. and its jump table entry is already loaded.
  2733.  
  2734. I would avoid opening resource files that can contain CODE segments
  2735. (or any other resources that may conflict with your app's). If you
  2736. need to open files like this, then you'll have to use UseResFile() to
  2737. swap between your app's resource fork and the subfiles resource forks.
  2738.  
  2739.     -phil
  2740. ----
  2741.    Phil Shapiro                                   Software Engineer
  2742.    Language Products Group                     Symantec Corporation
  2743.            Internet: phils@cs.brandeis.edu
  2744. 
  2745. 
  2746. Path: ucivax!gateway
  2747. From: wdh@well.sf.ca.us (Bill Hofmann)
  2748. Subject: Bug, or not?
  2749. Message-ID: <9205261617.AA26346@well.well.sf.ca.us>
  2750. Newsgroups: fa.think-c
  2751. Lines: 15
  2752. Date: 26 May 92 16:19:38 GMT
  2753.  
  2754. In previous versions of THINK, and I believe in current versions of MPW C, this
  2755. line produces a syntax error ("Can't take address of inline function"):
  2756.  
  2757.     MoreMasters;
  2758.  
  2759. THINK 5.x doesn't, it just ignores it.  This is a significant problem for my
  2760. students, who seem always to forget that Pascal omits parens when there's no
  2761. arguments, but C doesn't.  I'd argue that it should still be a bug.
  2762.  
  2763. PS, one of the strengths of THINK is its usefulness in a teaching environment.
  2764. How about optional warning of "variable used before initialized," and some of
  2765. the other very useful warnings of MPW C?  It catches *me* every so often, and
  2766. I've been doing Mac programming in C since SUMACS days.
  2767.  
  2768. -Bill Hofmann
  2769. 
  2770. 
  2771. Path: ucivax!gateway
  2772. From: news@cigna.uucp (Network News)
  2773. Subject: (none)
  2774. Message-ID: <9205261747.AA23463@Cigna.COM>
  2775. Newsgroups: fa.think-c
  2776. Lines: 59
  2777. Date: 26 May 92 18:31:09 GMT
  2778.  
  2779. Newsgroups: mail.think-c
  2780. Path: nagel
  2781. From: nagel@Cigna.COM (Mark Nagel)
  2782. Subject: Re: 'unsubscribe' noise
  2783. Message-ID: <1992May26.174714.23415@Cigna.COM>
  2784. Sender: news@Cigna.COM (Network News)
  2785. Nntp-Posting-Host: elvis
  2786. Organization: CIGNA FIRST, Irvine, CA
  2787. References: <9205251736.AA05725@world.std.com>
  2788. Date: Tue, 26 May 1992 17:47:14 GMT
  2789. Lines: 47
  2790.  
  2791. In <9205251736.AA05725@world.std.com> Rich Siegel <siegel@world.std.com> writes:
  2792.  
  2793. >It seems that many people know to mail to think-c-request to subscribe,
  2794. >but to unsubscribe, they always seem to mail to think-c, with the results
  2795. >we all know about.
  2796.  
  2797. It is a problem, and I wish I had a software solution to it.  In
  2798. some list management systems, you can specify simple patterns to
  2799. check for which trigger an automatic rejection of the message.  The
  2800. list software on ics.uci.edu does not have this feature and I'm no
  2801. longer in a position to modify it...
  2802.  
  2803. >The course of action I suggest is this: if an unsubscribe request goes out
  2804. >to the general list, it will not be acted upon, and the readers of the list
  2805. >(or some subset thereof) will send a message to the originator advising him
  2806. >that administrative requests should go to think-c-request, not to think-c.
  2807. >This has two benefits: novices reading the list (and considering unsubscribing)
  2808. >will be repeatedly reminded of the correct mechanism, and the person who
  2809. >asked to unsubscribe will (hopefully) get the message and use the correct
  2810. >mechanism.
  2811.  
  2812. I have always ignored administrative messages on the list itself
  2813. figuring that what you describe will occur.  For some reason, people
  2814. must either forget what I sent to them when they joined the list or
  2815. not even read it to begin with.  Perhaps I need to post a reminder.
  2816. I'm not sure it would work, since the offenders would probably fail
  2817. to read that as well.
  2818.  
  2819. I would also like to apologize in advance to anyone who feels they
  2820. are getting unacceptably slow response times from me when they
  2821. submit requests to think-c-request.  I am no longer at UCI and have
  2822. few occasions to login during my normal work hours.  I tend to login
  2823. about three times per week and just handle all requests when I get
  2824. there.  So if you think I'm ignoring you, I'm not :)
  2825.  
  2826. As far as the archives go, I believe I'll have no problem keeping
  2827. them there even though I no longer work at UCI unless something
  2828. unusual occurs.  If that ever does happen, I might request that the
  2829. list be moved to a different location.  I could move it here, but we
  2830. are not on the net which would greatly increase redistribution times
  2831. and prevent ftp access.
  2832.  
  2833. Mark
  2834. --
  2835. Mark Nagel <nagel@cigna.com>    | DISCLAIMER: If you had all of CIGNA's
  2836. Network Administrator        | in a container, you would not find mine
  2837. CIGNA/FIRST            | in that container.
  2838. 
  2839. 
  2840. Path: ucivax!gateway
  2841. From: iom@dsunx1.dsrd.ornl.gov (MIKOLIC-TORREI I)
  2842. Subject: Other ThC wish-list items...
  2843. Message-ID: <9205261843.AA14093@dsunx1.DSRD.ORNL.GOV>
  2844. Newsgroups: fa.think-c
  2845. Lines: 34
  2846. Date: 26 May 92 18:44:10 GMT
  2847.  
  2848.  
  2849. Bill Hofmann recently said:
  2850. >How about optional warning of "variable used before initialized," and some of
  2851. >the other very useful warnings of MPW C?
  2852.  
  2853. Can't agree more.  I'd also like to add the following "how about" items:
  2854.  
  2855. "variable declared but never used" -- after I optimize (er, okay, clean-up)
  2856. a function, I tend to have a few of these around.  Be nice to have the
  2857. compiler warn me (if I so choose).
  2858.  
  2859. "generate a list of errors (vice one at a time)" -- Turbo C v2 implemented
  2860. this quite nicely on the PC.  One window had a list of errors, if you
  2861. selected an error, your code window automatically scrolled to and highlighted
  2862. the offending line.  Having a super-fast comiler isn't so useful if you
  2863. compile the first half of your file 10^6 times while catching all the silly
  2864. typo-type errors.  Then again, I'm probably the only one who ever makes
  2865. typos in abundance :)
  2866.  
  2867. "value may be altered in conversion" -- I sometimes get a bit careless (and
  2868. even a bit confused at times) going back and forth between short and long,
  2869. signed and unsigned.  Some compilers would warn you whenever a bigger type
  2870. was squeezed into a "smaller" type (Turbo C in particular would).  Usually
  2871. I knew what I was doing, but saved me from myself on more than one occasion.
  2872.  
  2873. There are others, but I won't remember them until the next time
  2874. compile/debug something...
  2875.  
  2876. None of these are "must haves", but it would be nice (i.e., save time and
  2877. fustration) to be able to turn them on when you wanted them.  They would
  2878. make ThC a better product.
  2879.  
  2880. Igor Mikolic-Torreira
  2881.  
  2882. 
  2883. 
  2884. Path: ucivax!gateway
  2885. From: bobm@imagine.convex.com (Bob Miller)
  2886. Subject: Re: Think C 5.0.2 vs. TMON Pro 3.0 reprise
  2887. Message-ID: <9205261855.AA07376@Mr_Grape.convex.com>
  2888. In-Reply-To: Your message of "24 May 92 15:14:23 GMT."
  2889.              <9205241511.AA15873@chaos.cs.brandeis.edu>
  2890. Newsgroups: fa.think-c
  2891. X-Quote-Of-The: There's a young kid inside me somewhere
  2892.                 Who stays up all night, a vampire that never dies.
  2893.                 I hear his voice when I'm coming down.
  2894.                 "Sleep is for fools, who never see the sunrise,
  2895.                 Who never get to live twice."  -- John Entwhistle
  2896. Lines: 11
  2897. Date: 26 May 92 19:50:50 GMT
  2898.  
  2899. > Given that you have the address of the jump table entry, and given
  2900. > that it's a loaded entry, you can probaby use an expression like:
  2901. >
  2902. >     *(Ptr *)((char *)&main + 4) // should return "real" address of main
  2903. >
  2904. > (off the top of my head, no guarantees)
  2905.  
  2906. I think it should be "+ 2", not "+ 4".  The JMP opcode
  2907. is only two bytes.
  2908.  
  2909.                     K<bob>
  2910. 
  2911. 
  2912. Path: ucivax!gateway
  2913. From: a2mp@loki.cc.pdx.edu (Michael Perrone)
  2914. Subject: Re: Other ThC wish-list items...
  2915. Message-ID: <9205262104.AA22213@loki.cc.pdx.edu>
  2916. In-Reply-To: <9205261843.AA14093@dsunx1.DSRD.ORNL.GOV>; from "MIKOLIC-TORREI I" at May 26, 92 6:44 pm
  2917. X-Mailer: ELM [version 2.3 PL11]
  2918. Newsgroups: fa.think-c
  2919. Lines: 23
  2920. Date: 26 May 92 21:05:18 GMT
  2921.  
  2922. MIKOLIC-TORREI I writes:
  2923. >
  2924. >
  2925. > Bill Hofmann recently said:
  2926. > >How about optional warning of "variable used before initialized," and some of
  2927. > >the other very useful warnings of MPW C?
  2928. >
  2929. > Can't agree more.  I'd also like to add the following "how about" items:
  2930. >
  2931. > "variable declared but never used" -- after I optimize (er, okay, clean-up)
  2932. > a function, I tend to have a few of these around.  Be nice to have the
  2933. > compiler warn me (if I so choose).
  2934. [...]
  2935.  
  2936. What this really comes down to is that a "lint" is needed for Think C.
  2937. I would really like that, myself.
  2938.  
  2939. ***********************************************/
  2940. * Michael Perrone   *   Programmer/Analyst     *
  2941. * Portland State University, Portland OREGON   *
  2942. * INTERNET          a2mp@loki.cc.pdx.edu       *
  2943. * VOICE  (503) 725-3112  FAX (503) 725-4882    *
  2944. ***********************************************/
  2945. 
  2946. 
  2947. Path: ucivax!gateway
  2948. From: huff@mcclb0.med.nyu.edu ("Edward J. Huff")
  2949. Subject: think-c-request and other useful information
  2950. Message-ID: <01GKHJNPPRZ40003FI@MCCLB0.MED.NYU.EDU>
  2951. Newsgroups: fa.think-c
  2952. Lines: 105
  2953. Date: 27 May 92 04:42:30 GMT
  2954. X-Envelope-to: think-c@ics.uci.edu
  2955.  
  2956. Here is a copy of the form letter I (usually) send out when
  2957. I receive a subscribe or unsubscribe request on the think-c
  2958. list.  I was out of town for the past week and did not send
  2959. this for most of the recent spate of unsubscribe request.
  2960.  
  2961. You might find some new information here.  Is the mailing
  2962. list charter up to date?
  2963.  
  2964. Subject:  Please send requests to think-c-request@ics.uci.edu
  2965.  
  2966. Most mailing lists with address "xxx@yyy" have an associated address
  2967. "xxx-request@yyy" which is used for requests about your subscription, so
  2968. that everyone on the list doesn't have to read about your subscription.
  2969.  
  2970. The following can be found in "Publicly Accessible Mailing Lists, Part
  2971. III", which is periodically posted to news.announce.newusers.  If it is
  2972. expired at your site, you can obtain it by anonymous FTP or mail server
  2973. from site PIT-MANAGER.MIT.EDU.  More information on how to do this is given
  2974. below.
  2975.  
  2976. think-c
  2977.     Contact: think-c-request@ics.uci.edu  (Mark Nagel)
  2978.  
  2979.     Purpose: This list exists to discuss the Think C compiler for the
  2980.     Macintosh.  Acceptable topics include discussion of compiler
  2981.     problems and solutions/workarounds, discussion of object-oriented
  2982.     programming and Macintosh programming, and the sharing of source
  2983.     code.  Associated with this list is an archive stored on
  2984.     ics.uci.edu accessible via ftp and a mail archive server
  2985.     (archive-server@ics.uci.edu).  Submissions to the archive should
  2986.     go to think-c-request.
  2987.  
  2988.  
  2989. This came from "Answers to Frequently Asked Questions" in the USENET
  2990. newsgroup news.announce.newusers:
  2991.  
  2992. 30.  How do I contact the moderator of an Internet mailing list rather than
  2993.      post to the entire list?
  2994.  
  2995.      To do this you should know that there are, by convention, two
  2996.      mailing addresses for every mailing list (except where noted by
  2997.      the List of Lists):
  2998.  
  2999.          list@host        (e.g. xpert@expo.lcs.mit.edu)
  3000.          list-request@host    (e.g. xpert-request@expo.lcs.mit.edu)
  3001.  
  3002.      When you have something for everyone on the mailing list to read,
  3003.      mail to the list@host address. HOWEVER, if you have an
  3004.      administrative request to make (e.g. "please add me to this list",
  3005.      "please remove me from this list", "where are the archives?",
  3006.      "what is this mailer error I got from sending to this list?"), it
  3007.      should be directed to the list-request@host address, which goes
  3008.      only to the mailing list administrator.
  3009.  
  3010.      It is considered to be in bad taste to send administrative
  3011.      requests to the entire mailing list in question, and if (as is
  3012.      often the case) the administrator does not read the mailing list
  3013.      (i.e. he just takes care of the admin tasks for the list), he will
  3014.      not see your request if you don't send it to the right address.
  3015.  
  3016.  
  3017. This came from "List of Periodic Informational Postings" in
  3018. news.announce.newusers:
  3019.  
  3020. 3/21/90
  3021.  
  3022. Jonathan Kamens of MIT's Project Athena has kindly set up an archive of
  3023. periodic postings; the archive is constructed by a shell script which reads
  3024. this article, using it as a guide as to which postings should be archived.
  3025. What follows is a condensed excerpt of his article announcing this
  3026. archive...
  3027.  
  3028. This archive is on "pit-manager.mit.edu" (18.72.1.58), and is accessible
  3029. via anonymous ftp in the directory "/pub/usenet".  The structure of this
  3030. directory is such that each subdirectory is a newsgroup name, and the files
  3031. in the subdirectories are the periodic postings.  The filenames are
  3032. constructed by mapping the titles to filenames in a pretty simple way, e.g.
  3033.  
  3034. /pub/usenet/news.announce.newusers/Answers_to_Frequently_Asked_Questions
  3035.  
  3036. The archive is also accessible via mail archive server.  The address of the
  3037. server is mail-server@pit-manager.mit.edu.  The names are the same, with
  3038. the "/pub/" chopped off.  To retrieve the file mentioned above, you would
  3039. send mail to the mail-server with a subject or body of
  3040.  
  3041. send usenet/news.announce.newusers/Answers_to_Frequently_Asked_Questions
  3042.  
  3043. You can also do "send help", "send index", "send usenet/index", "send
  3044. usenet/news.announce.newusers/index", etc.
  3045.  
  3046. Comments, questions, suggestions, etc. can be sent to me at the address
  3047. below, or at {root,jik,postmaster,daemon}@pit-manager.mit.edu.  Feel free
  3048. to mention this service in any informational postings you may maintain; I
  3049. hope to keep it up and running for a while.
  3050.  
  3051.  
  3052. Jonathan Kamens          USnail:
  3053. MIT Project Athena       11 Ashford Terrace
  3054. jik@Athena.MIT.EDU       Allston, MA  02134
  3055. Office: 617-253-8085     Home: 617-782-0710
  3056. --
  3057. Edward J. Huff   huff@mcclb0.med.nyu.edu   (212)998-8465
  3058. Keck Laboratory for Biomolecular Imaging
  3059. NYU Chemistry Deptartment, 31 Washington Place, New York NY 10003
  3060.  
  3061. 
  3062. 
  3063. Path: ucivax!gateway
  3064. From: chuck@ksr.com
  3065. Subject: Segmentation bug -- maybe
  3066. Message-ID: <9205271349.AA08067@z8.ksr.com>
  3067. Newsgroups: fa.think-c
  3068. Lines: 35
  3069. Date: 27 May 92 13:48:53 GMT
  3070.  
  3071.  
  3072. I traced down a bug which, although I can pinpoint and even avoid, I still
  3073. do not understand.  I wonder if anyone can help.
  3074.  
  3075. The symptom was that an important data structure in my program got
  3076. clobbered.  I traced it down to a memcpy() call which did not work.  I
  3077. single stepped in the debugger, and I am absolutely sure that I supply
  3078. perfectly good pointers and byte-count to the procedure.  I tried to
  3079. replace memcpy() with strncpy() (I have no zero-bytes in the stuff I am
  3080. copying), but that did not help.
  3081.  
  3082. The thing that really puzzled me was that the very same memcpy() line, in
  3083. the very same procedure, worked fine EVERY TIME EXCEPT THE FIRST.  In other
  3084. words, there is something funny about the first time memcpy() or strncpy()
  3085. are called.
  3086.  
  3087. My first remedy was to replace the memcpy() with a one-line for loop, and
  3088. that solved the problem.  But then it occured to me that if there is
  3089. something funny about the first time I called an ANSI routine, I might as
  3090. well call a dummy ANSI routine once.  So I added the following statement as
  3091. the very first statement in my main():
  3092.  
  3093.     { char dummy[100];  sprintf(dummy, "load my segment"); }
  3094.  
  3095. and restored the memcpy().  Now everything works just fine - memcpy() works
  3096. great the first time as well as any other time.
  3097.  
  3098. I am using TCL, if that matters, and also I have recompiled ANSI to use the
  3099. native floating point mode.  The ANSI library is in a separate segment.
  3100.  
  3101.  
  3102. Thank,
  3103.  
  3104. Chuck Shavit
  3105. chuck@ksr.com
  3106. 
  3107. 
  3108. Path: ucivax!gateway
  3109. From: aw0g+@andrew.cmu.edu (Aaron Wohl)
  3110. Subject: Re: Segmentation bug -- maybe
  3111. Message-ID: <Qe8u6Ha00WA1A1O1Jq@andrew.cmu.edu>
  3112. In-Reply-To: <9205271349.AA08067@z8.ksr.com>
  3113. Newsgroups: fa.think-c
  3114. Lines: 14
  3115. Date: 27 May 92 14:51:51 GMT
  3116. References: <9205271349.AA08067@z8.ksr.com>
  3117.  
  3118. I had the same problem...
  3119.  
  3120. The problem is that the segment mempcy is in is not resident.  The first
  3121. time it is called it is loaded in cand the segment loader can cause a
  3122. garbage collection and move the unlocked dereferenced handle being
  3123. passed to memcpy.  Since TCL object are really handles if you are
  3124. passing a variable inside an object to memcpy it will do this.
  3125.  
  3126. The simplest way around it is to create empty routines:
  3127. void load_seg1()
  3128. {}
  3129.  
  3130. and have one such routine in each segment you want to load at startup.
  3131. Aaron
  3132. 
  3133. 
  3134. Path: ucivax!gateway
  3135. From: chuck@ksr.com
  3136. Subject: Segmentation bug -- maybe
  3137. Message-ID: <9205271501.AA08188@z8.ksr.com>
  3138. In-Reply-To: Aaron Wohl's message of Wed, 27 May 1992 10:49:55 -0400 (EDT) <Qe8u6Ha00WA1A1O1Jq@andrew.cmu.edu>
  3139. Newsgroups: fa.think-c
  3140. Lines: 30
  3141. Date: 27 May 92 15:01:30 GMT
  3142.  
  3143. > Date: Wed, 27 May 1992 10:49:55 -0400 (EDT)
  3144. > From: Aaron Wohl <aw0g+@andrew.cmu.edu>
  3145. >
  3146. > I had the same problem...
  3147. >
  3148. > The problem is that the segment mempcy is in is not resident.  The first
  3149. > time it is called it is loaded in cand the segment loader can cause a
  3150. > garbage collection and move the unlocked dereferenced handle being
  3151. > passed to memcpy.  Since TCL object are really handles if you are
  3152. > passing a variable inside an object to memcpy it will do this.
  3153. >
  3154. > The simplest way around it is to create empty routines:
  3155. > void load_seg1()
  3156. > {}
  3157. >
  3158. > and have one such routine in each segment you want to load at startup.
  3159. > Aaron
  3160. >
  3161.  
  3162. Thank, Aaron.
  3163.  
  3164. BTW, are there conditions in which TC or Mac O/S decide to unload a
  3165. segment?  If so, is there a way to lock segments like the ANSI library in
  3166. place?
  3167.  
  3168. I just thought of another way to load the ANSI segment: have my main()
  3169. code, which is rather small, reside in the same segment as ANSI.  I'll try
  3170. that tonight.
  3171.  
  3172. Chuck Shavit
  3173. 
  3174. 
  3175. Path: ucivax!gateway
  3176. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  3177. Subject: Re: Segmentation bug -- maybe
  3178. Message-ID: <9205271545.AA18072@hobbes.kzoo.edu>
  3179. In-Reply-To: <9205271349.AA08067@z8.ksr.com>; from "chuck@ksr.com" at May 27, 92 1:48 pm
  3180. X-Mailer: ELM [version 2.3 PL11]
  3181. Newsgroups: fa.think-c
  3182. Lines: 16
  3183. Date: 27 May 92 15:43:46 GMT
  3184.  
  3185. > The symptom was that an important data structure in my program got
  3186. > clobbered.  I traced it down to a memcpy() call which did not work.  I
  3187. > single stepped in the debugger, and I am absolutely sure that I supply
  3188. > perfectly good pointers and byte-count to the procedure.
  3189. >
  3190. > The thing that really puzzled me was that the very same memcpy() line, in
  3191. > the very same procedure, worked fine EVERY TIME EXCEPT THE FIRST.
  3192. > ... The ANSI library is in a separate segment.
  3193.  
  3194. That memory that you're coping to--is it in an unlocked handle?  If the
  3195. segment with the ANSI library needs to be loaded in, the call to
  3196. memcpy() could well move memory.
  3197. --
  3198.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  3199.  "Also thanks to:  Inside Macintosh (except vol. V, ch. 27)"
  3200.    - the Tesserae "About..." box
  3201. 
  3202. 
  3203. Path: ucivax!gateway
  3204. From: holla%monique@gatech.edu (Craig Hollabaugh)
  3205. Subject: Re:  Segmentation bug -- maybe
  3206. Message-ID: <9205271538.AA14011@monique.adgrp.gatech.edu>
  3207. Newsgroups: fa.think-c
  3208. Lines: 9
  3209. Date: 27 May 92 15:49:39 GMT
  3210.  
  3211.  
  3212. >The thing that really puzzled me was that the very same memcpy() line, in
  3213. >the very same procedure, worked fine EVERY TIME EXCEPT THE FIRST.  In other
  3214. >words, there is something funny about the first time memcpy() or strncpy()
  3215. >are called.
  3216.  
  3217. I've experienced the same problem also, except I was using printf(). So
  3218. you are not going crazy. Unfortunately I can't offer any suggestions.
  3219.  
  3220. 
  3221. 
  3222. Path: ucivax!gateway
  3223. From: chuck@ksr.com
  3224. Subject: Segmentation bug -- maybe
  3225. Message-ID: <9205271557.AA08470@z8.ksr.com>
  3226. In-Reply-To: Jamie R. McCarthy's message of Wed, 27 May 92 11:45:19 EDT <9205271545.AA18072@hobbes.kzoo.edu>
  3227. Newsgroups: fa.think-c
  3228. Lines: 37
  3229. Date: 27 May 92 15:56:53 GMT
  3230.  
  3231. > From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  3232. > Date: Wed, 27 May 92 11:45:19 EDT
  3233. >
  3234. > > The symptom was that an important data structure in my program got
  3235. > > clobbered.  I traced it down to a memcpy() call which did not work.  I
  3236. > > single stepped in the debugger, and I am absolutely sure that I supply
  3237. > > perfectly good pointers and byte-count to the procedure.
  3238. > >
  3239. > > The thing that really puzzled me was that the very same memcpy() line, in
  3240. > > the very same procedure, worked fine EVERY TIME EXCEPT THE FIRST.
  3241. > > ... The ANSI library is in a separate segment.
  3242. >
  3243. > That memory that you're coping to--is it in an unlocked handle?  If the
  3244. > segment with the ANSI library needs to be loaded in, the call to
  3245. > memcpy() could well move memory.
  3246. > --
  3247. >  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  3248. >  "Also thanks to:  Inside Macintosh (except vol. V, ch. 27)"
  3249. >    - the Tesserae "About..." box
  3250. >
  3251.  
  3252. Yes indeed.  I guess I was not aware of the fact that segment loading can
  3253. happen when I am not expecting it, and that it can move memory under me.
  3254.  
  3255. Of course, I use memcpy() and not a simple for loop because I want speed,
  3256. so it does not make sense to me to lock the handle before memcpy() and
  3257. unlock it afterwards.  I think that my solution -- to cause the ANSI
  3258. segment to load before I first use it -- is the right one.
  3259.  
  3260. Which brings the following question -- if I pass a dereferenced (unlocked)
  3261. handle to a function, how can I ensure that the function I am calling is
  3262. resident in core?  I guess the case of TCL methods is easier, because when
  3263. you access a method you must have created the object beforehand, and in
  3264. most cases you have a constructor which resides in the same segment as the
  3265. method.  But what about other functions?
  3266.  
  3267. Chuck Shavit
  3268. 
  3269. 
  3270. Path: ucivax!gateway
  3271. From: siegel@world.std.com (Rich Siegel)
  3272. Subject: Re:  Segmentation bug -- maybe
  3273. Message-ID: <9205271622.AA05003@world.std.com>
  3274. Newsgroups: fa.think-c
  3275. Lines: 7
  3276. Date: 27 May 92 16:22:47 GMT
  3277.  
  3278. If the source or target of your memcpy() is in a relocatable block (allocated
  3279. by NewHandle()), then it very likely will move when a code segment gets
  3280. loaded. To avoid bugs like this, you should lock your relocatable blocks
  3281. before computing pointers into them, if you're planning to call any routines
  3282. that could move memory.
  3283.  
  3284. R.
  3285. 
  3286. 
  3287. Path: ucivax!gateway
  3288. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  3289. Subject: Re: Segmentation bug -- maybe
  3290. Message-ID: <9205271634.AA19476@hobbes.kzoo.edu>
  3291. In-Reply-To: <9205271557.AA08470@z8.ksr.com>; from "chuck@ksr.com" at May 27, 92 11:57 am
  3292. X-Mailer: ELM [version 2.3 PL11]
  3293. Newsgroups: fa.think-c
  3294. Lines: 66
  3295. Date: 27 May 92 16:32:39 GMT
  3296.  
  3297. chuck@ksr.com writes:
  3298. > > From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  3299. > > [chuck writes:]
  3300. > > > The thing that really puzzled me was that the very same memcpy() line, in
  3301. > > > the very same procedure, worked fine EVERY TIME EXCEPT THE FIRST.
  3302. > > > ... The ANSI library is in a separate segment.
  3303. > >
  3304. > > That memory that you're coping to--is it in an unlocked handle?  If the
  3305. > > segment with the ANSI library needs to be loaded in, the call to
  3306. > > memcpy() could well move memory.
  3307. >
  3308. > Of course, I use memcpy() and not a simple for loop because I want speed,
  3309. > so it does not make sense to me to lock the handle before memcpy() and
  3310. > unlock it afterwards.
  3311.  
  3312. How much memory are you copying?  If it's more than a few hundred bytes,
  3313. the copy will take much longer than the locking/unlocking will.  If it's
  3314. not, don't worry about speed!  :-)
  3315.  
  3316. Seriously, the only way that the HLock/HUnlock should cause any
  3317. noticeable delay is if it's called within an oft-repeated loop.  Now,
  3318. either this loop (excepting any segment loading) can move memory or it
  3319. can't.  If it can't, call HLock before and HUnlock after, and don't
  3320. worry about possible memory management inefficiencies, because there
  3321. won't be any.  If it _can_, any memory move might take much longer than
  3322. your memcpy(), and certainly longer than a few thousand HLock/HUnlock's.
  3323.  
  3324. So if the loop can move memory:
  3325.  
  3326. for (i = 0; i < LARGENUMBER; ++i) {
  3327.     HLock(theHndl);
  3328.     memcpy(source, *theHndl, bytes);
  3329.     HUnlock(theHndl);
  3330.     possibleMemoryMovingFunction();
  3331. }
  3332.  
  3333. ...and if it can't:
  3334.  
  3335. HLock(theHndl);
  3336. for (i = 0; i < LARGENUMBER; ++i) {
  3337.     memcpy(source, *theHndl, bytes);
  3338.     nonMemoryMovingFunction();
  3339. }
  3340. HUnlock(theHndl);
  3341.  
  3342. You might want to MoveHHi(theHndl), too, so there's little chance of the
  3343. loading of the segment interfering with it.  (The Segment Loader tries
  3344. its best to get 'CODE' resources low in the heap.)
  3345. > I think that my solution -- to cause the ANSI
  3346. > segment to load before I first use it -- is the right one.
  3347.  
  3348. But then you can't ever unload it again.  Which is fine if you're not in
  3349. a memory squeeze...but if you are, it's nice to be able to dispose of
  3350. unneeded segments.  This kind of memory-management is something you have
  3351. to design from the start;  you can't add it on a week before you ship.
  3352.  
  3353. > if I pass a dereferenced (unlocked)
  3354. > handle to a function, how can I ensure that the function I am calling is
  3355. > resident in core?
  3356.  
  3357. Hmmmm...you know, I guess I don't know.  Anyone else?
  3358. --
  3359.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  3360.  "A common way to answer a question about C is to 'see what the compiler
  3361.   does.'  Clearly C has suffered from being partly defined, then
  3362.   implemented."  - High C language reference manual, 1987
  3363. 
  3364. 
  3365. Path: ucivax!gateway
  3366. From: chuck@ksr.com
  3367. Subject: Segmentation bug -- maybe
  3368. Message-ID: <9205271710.AA08838@z8.ksr.com>
  3369. In-Reply-To: Rich Siegel's message of Wed, 27 May 92 12:22:36 -0400 <9205271622.AA05003@world.std.com>
  3370. Newsgroups: fa.think-c
  3371. Lines: 19
  3372. Date: 27 May 92 17:10:56 GMT
  3373.  
  3374. > Date: Wed, 27 May 92 12:22:36 -0400
  3375. > From: siegel@world.std.com (Rich Siegel)
  3376. >
  3377. > If the source or target of your memcpy() is in a relocatable block (allocated
  3378. > by NewHandle()), then it very likely will move when a code segment gets
  3379. > loaded. To avoid bugs like this, you should lock your relocatable blocks
  3380. > before computing pointers into them, if you're planning to call any routines
  3381. > that could move memory.
  3382. >
  3383. > R.
  3384. >
  3385.  
  3386. Thanks Rick.
  3387.  
  3388. I am not sure the problem is neccasarily related to memory moving
  3389. procedures - I bet things like strlen() could be led astray in much the
  3390. same way.
  3391.  
  3392. Chuck
  3393. 
  3394. 
  3395. Path: ucivax!gateway
  3396. From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
  3397. Subject: what exactly are segements...
  3398. Message-ID: <920527104758.220033d1@AZCC.Arizona.EDU>
  3399. Newsgroups: fa.think-c
  3400. Lines: 19
  3401. Date: 27 May 92 17:48:28 GMT
  3402. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  3403.  
  3404. Ok,
  3405.   I have been reading the Think C manual (oh my god what is the world coming
  3406. to? someone reading a manual??? :)), and they keep bringing up the 32k segement
  3407. size.  And well, I am not really sure why this magic number is used.  I haven't
  3408. read the complete set of IM, but of the ones that I have read, I don't recall
  3409. this "limitation" if it is one.
  3410.  
  3411.   Could someone explain it to me, or point me in the right direction, as to
  3412. where I can find the answer?
  3413.  
  3414. Thanks,
  3415.  
  3416. Mike
  3417.  
  3418. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3419. Mike Ruhl
  3420. Operator/mac learner..
  3421. Arizona Cancer Center
  3422. mruhl@azcc.arizona.edu
  3423. 
  3424. 
  3425. Path: ucivax!gateway
  3426. From: siegel@world.std.com (Rich Siegel)
  3427. Subject: Re:  Segmentation bug -- maybe
  3428. Message-ID: <9205271839.AA15575@world.std.com>
  3429. Newsgroups: fa.think-c
  3430. Lines: 10
  3431. Date: 27 May 92 18:39:40 GMT
  3432.  
  3433. >BTW, are there conditions in which TC or Mac O/S decide to unload a
  3434. >segment?
  3435.  
  3436. No. Segments are never unloaded without an explicit call to UnloadSeg()
  3437. by your application.
  3438.  
  3439. Placing the file containing main() in the same segment as ANSI is a fine
  3440. idea, and will work correctly.
  3441.  
  3442. R.
  3443. 
  3444. 
  3445. Path: ucivax!gateway
  3446. From: KFISCHER@arac.llnl.gov (Kathleen Fischer)
  3447. Subject: Re: Segmentation bug -- maybe
  3448. Message-ID: <01GKI9XBVCWW000X64@addvax.llnl.gov>
  3449. Newsgroups: fa.think-c
  3450. X-VMS-To: ADDVAX::IN%"think-c@ics.uci.EDU"
  3451. Lines: 12
  3452. Date: 27 May 92 20:14:42 GMT
  3453. X-Envelope-to: think-c@ics.uci.EDU
  3454.  
  3455. >Of course, I use memcpy() and not a simple for loop because I want speed,
  3456. >so it does not make sense to me to lock the handle before memcpy() and
  3457. >unlock it afterwards.  I think that my solution -- to cause the ANSI
  3458. >segment to load before I first use it -- is the right one.
  3459.  
  3460. Ok -- I was following this discussion just fine (for a beginner) until the
  3461. reference above to _speed_.  Why would locking/unlocking a handle be slow?
  3462. Does the memory manager try to compact the space first?  I would think
  3463. that locking/unlocking would be much safer than calling the ANSI segment
  3464. first.
  3465.  
  3466. Kathleen
  3467. 
  3468. 
  3469. Path: ucivax!gateway
  3470. From: SCHENKL@vax.cs.hscsyr.edu
  3471. Subject: MacBinary Source
  3472. Message-ID: <920527182434.20206372@vax.cs.hscsyr.edu>
  3473. Newsgroups: fa.think-c
  3474. Lines: 7
  3475. Date: 27 May 92 22:27:18 GMT
  3476. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  3477.  
  3478. I'm writing a BBS host package, and I need some routines to do some MacBinary
  3479. conversions. I have looked in all of the sources I know of, and if anyone could
  3480. help point me to some Think C-compilable code, I would be greatful.
  3481.  
  3482. Thanks.
  3483.  
  3484. schenkl@vax.cs.hscsyr.edu
  3485. 
  3486. 
  3487. Path: ucivax!gateway
  3488. From: mxmora@unix.sri.com
  3489. Subject: Re: Segmentation bug -- maybe
  3490. Message-ID: <9205272359.AB26462@unix.sri.com>
  3491. Newsgroups: fa.think-c
  3492. Lines: 34
  3493. Date: 27 May 92 23:59:36 GMT
  3494.  
  3495.  
  3496. >Ok -- I was following this discussion just fine (for a beginner) until the
  3497. >reference above to _speed_.  Why would locking/unlocking a handle be slow?
  3498. >Does the memory manager try to compact the space first?  I would think
  3499. >that locking/unlocking would be much safer than calling the ANSI segment
  3500. >first.
  3501.  
  3502. You are correct in believing that Hlock/Hunlock takes very little time.
  3503. They
  3504. really only set or unset a bit. It does not do any memory compaction or
  3505. movement.(at least it says it doesn't move memory) But you still have the
  3506. trap
  3507. overhead. Any call to an Atrap is going to take a little extra time because
  3508. of
  3509. the trap mechanism. (ie find the right address then jump to it or what ever
  3510. it
  3511. does).
  3512.  
  3513. In a tight loop you really don't want to do this if speed is your main
  3514. concern.
  3515. Its best to call hlock outside of the loop and the hunlock when you exit
  3516. the loop. Or if you want to be gutsy you can get the trap address yourself
  3517. and jump to it.
  3518.  
  3519.  
  3520. Matt
  3521. _____________________________________________________________________
  3522.    Matthew Xavier Mora                   |  The keeper of the UMPG
  3523.    SRI International                     |  Matt_Mora@QM.sri.com
  3524.    [sent using Eudora 1.3b34]            |  mxmora@unix.sri.com
  3525. _____________________________________________________________________
  3526. "You give good headgames, your tongue is so strange, caught in these
  3527.  backstage chains." _Crashed_ by Slik Toxik
  3528.  
  3529. 
  3530. 
  3531. Path: ucivax!gateway
  3532. From: pmiller@gneiss.bmr.gov.au (Peter Miller)
  3533. Subject: Re: Segmentation bug -- maybe
  3534. Message-ID: <9205280008.AA03818@gneiss.bmr.gov.au>
  3535. In-Reply-To: Your message of 27 May 92 17:10:56 +0000.
  3536.              <9205271710.AA08838@z8.ksr.com>
  3537. Newsgroups: fa.think-c
  3538. Lines: 13
  3539. Date: 28 May 92 00:06:38 GMT
  3540.  
  3541.  
  3542. chuck@ksr.com writes:
  3543. > I am not sure the problem is neccasarily related to memory moving
  3544. > procedures - I bet things like strlen() could be led astray in much the
  3545. > same way.
  3546.  
  3547. this is my
  3548. Golden Rule of Mac Programming:
  3549.  
  3550. When manipulating dynamic memory contents - Lock Those Handles.
  3551.  
  3552. Regards
  3553. Peter Miller.
  3554. 
  3555. 
  3556. Path: ucivax!gateway
  3557. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  3558. Subject: Re: Segmentation bug -- maybe
  3559. Message-ID: <199205280340.AA18583@tarski.cogsci.uiuc.edu>
  3560. X-Mailer: Eudora [version 1.3a39 MacTCP]
  3561. Newsgroups: fa.think-c
  3562. Lines: 36
  3563. Date: 28 May 92 03:41:41 GMT
  3564.  
  3565. KFISCHER@arac.llnl.gov (Kathleen Fischer) writes:
  3566.  
  3567. >Ok -- I was following this discussion just fine (for a beginner) until the
  3568. >reference above to _speed_.  Why would locking/unlocking a handle be slow?
  3569.  
  3570. Calling any Macintosh Toolbox/OS routine is always going to be slow if
  3571. speed is *really* important. Remember that Toolbox calls are traps: that
  3572. is, 2 bytes of illegal instruction are inserted into the assembly code that
  3573. cause the 680x0 processor to trap to an illegal instruction handler, the
  3574. trap table. Every time the processor traps, it has to but the entire world
  3575. onto the stack, set up some stuff, use the appropriate value in the trap
  3576. table to jump to a routine and then undo everything that it has done.
  3577. Something like memcpy() is just a whole lot of MOVE instructions, which
  3578. really take no time at all. If this is being called repeatedly in a loop
  3579. (let's say you were moving lots of multiple K buffers all over the place),
  3580. the locking and unlocking would hurt quite a bit.
  3581.  
  3582. MRUHL@azcc.arizona.edu (Mike Ruhl) writes:
  3583.  
  3584. >  I have been reading the Think C manual (oh my god what is the world coming
  3585. >to? someone reading a manual??? :)), and they keep bringing up the 32k segement
  3586. >size.  And well, I am not really sure why this magic number is used.  I haven't
  3587. >read the complete set of IM, but of the ones that I have read, I don't recall
  3588. >this "limitation" if it is one.
  3589.  
  3590. I think this is mentioned in the Segment Loader chapter in IM II. The
  3591. problem is that 32K of memory is all that you can specify in 2 bytes (16
  3592. bits). In the 68000 instruction set, you can only use PC (program counter)
  3593. address mode with a 16 bit offset; there is no 32 bit addressing mode. The
  3594. biggest number (signed) that you can specify in 16 bits is 32768, hence the
  3595. 32K limit on any one piece of code.
  3596.  
  3597. How's that?
  3598.  
  3599. pr
  3600.  
  3601. 
  3602. 
  3603. Path: ucivax!gateway
  3604. From: potts@itl.itd.umich.edu (Paul Potts)
  3605. Subject: Re: 32K segment size
  3606. Message-ID: <9205281313.AA01099@itl.itd.umich.edu>
  3607. Newsgroups: fa.think-c
  3608. Lines: 28
  3609. Date: 28 May 92 13:14:30 GMT
  3610.  
  3611.  
  3612. Pete Resnick <resnick@cogsci.uiuc.edu> writes:
  3613.  
  3614. >In the 68000 instruction set, you can only use PC (program counter)
  3615. >address mode with a 16 bit offset; there is no 32 bit addressing mode.
  3616.  
  3617. This is true, but doesn't address the 32K segment size fully. After all,
  3618. it is quite possible (and MPW C and THINK C now allow the programmer) to
  3619. build code and data in pieces larger than 32K.
  3620.  
  3621. There is no intrinsic limit in the 68000 family that say you can only jump
  3622. +/- 32K. With the Mac 128, because memory was so tight, the designers wanted
  3623. to implement a memory overlay scheme similar to the way DOS programs do it -
  3624. with segments loaded and unloaded as needed to conserve space. The 16-bit
  3625. PC-relative jump was used because it is also small, tight, and doesn't
  3626. require much overhead. (Yes, there is a limit on this particular form of
  3627. jump instruction). The standard jump table allows 32K of entry points; using
  3628. THINK C's far code option gives you 256K of entry points, enough for quite
  3629. a large number of functions or member functions, although the 32-bit
  3630. absolute address mode requires more space for each one, I believe. I think
  3631. the OS still expects your code to be in 32K segments. That is somewhat of
  3632. an anachronism, but the overlay scheme is still useful in tight memory
  3633. situations if your application is written to take advantage of it.
  3634.  
  3635. I just wanted to point out that the 68000 isn't an 8086 - there aren't
  3636. "hard" limits on code and data segments, and no weird memory models that
  3637. hinder the programmer. After all, we're all adults here... we don't need
  3638. a CPU that is designed for kids!  : )
  3639. 
  3640. 
  3641. Path: ucivax!gateway
  3642. From: potts@itl.itd.umich.edu (Paul Potts)
  3643. Subject: Re: 32K segment size
  3644. Message-ID: <9205281314.AA01108@itl.itd.umich.edu>
  3645. Newsgroups: fa.think-c
  3646. Lines: 28
  3647. Date: 28 May 92 13:15:34 GMT
  3648.  
  3649.  
  3650. Pete Resnick <resnick@cogsci.uiuc.edu> writes:
  3651.  
  3652. >In the 68000 instruction set, you can only use PC (program counter)
  3653. >address mode with a 16 bit offset; there is no 32 bit addressing mode.
  3654.  
  3655. This is true, but doesn't address the 32K segment size fully. After all,
  3656. it is quite possible (and MPW C and THINK C now allow the programmer) to
  3657. build code and data in pieces larger than 32K.
  3658.  
  3659. There is no intrinsic limit in the 68000 family that say you can only jump
  3660. +/- 32K. With the Mac 128, because memory was so tight, the designers wanted
  3661. to implement a memory overlay scheme similar to the way DOS programs do it -
  3662. with segments loaded and unloaded as needed to conserve space. The 16-bit
  3663. PC-relative jump was used because it is also small, tight, and doesn't
  3664. require much overhead. (Yes, there is a limit on this particular form of
  3665. jump instruction). The standard jump table allows 32K of entry points; using
  3666. THINK C's far code option gives you 256K of entry points, enough for quite
  3667. a large number of functions or member functions, although the 32-bit
  3668. absolute address mode requires more space for each one, I believe. I think
  3669. the OS still expects your code to be in 32K segments. That is somewhat of
  3670. an anachronism, but the overlay scheme is still useful in tight memory
  3671. situations if your application is written to take advantage of it.
  3672.  
  3673. I just wanted to point out that the 68000 isn't an 8086 - there aren't
  3674. "hard" limits on code and data segments, and no weird memory models that
  3675. hinder the programmer. After all, we're all adults here... we don't need
  3676. a CPU that is designed for kids!  : )
  3677. 
  3678. 
  3679. Path: ucivax!gateway
  3680. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  3681. Subject: Segmentation bug -- maybe
  3682. Message-ID: <9205281316.AA22059@chaos.cs.brandeis.edu>
  3683. In-Reply-To: "Jamie R. McCarthy"'s message of 27 May 92 16:32:39 GMT <9205271634.AA19476@hobbes.kzoo.edu>
  3684. Newsgroups: fa.think-c
  3685. Lines: 30
  3686. Date: 28 May 92 13:19:17 GMT
  3687.  
  3688. >>>>> On 27 May 92 16:32:39 GMT, "Jamie R. McCarthy" <k044477@hobbes.kzoo.edu> said:
  3689.  
  3690. >> if I pass a dereferenced (unlocked) handle to a function, how can I
  3691. >> ensure that the function I am calling is resident in core?
  3692.  
  3693.  > Hmmmm...you know, I guess I don't know.  Anyone else?
  3694.  
  3695. If you take the address of a function, you'll actually get the address
  3696. of that function's jump table entry. If you take the address of a
  3697. static function, then THINK C will assign it a jump table entry
  3698. automatically (I believe a pragma is necessary in MPW C).
  3699.  
  3700. If you want to be sure that the jump table entry is loaded, then
  3701. you've got to call some function in the segment in question. Typically
  3702. programmers create one dummy function per unloadable segment, and use
  3703. the dummy function to load or unload a segment.
  3704.  
  3705. Most programs don't need to unload segments at all; dummy functions
  3706. may still come in handy if you want to ensure that all segments are
  3707. loaded at a certain point on your program (such as calling memcpy()
  3708. into an instance variable of a handle-based object :).
  3709.  
  3710. A great (although getting on in years) book on this topic is Scott
  3711. Knaster's "How to Write Macintosh Software".
  3712.  
  3713.     -phil
  3714. ----
  3715.    Phil Shapiro                                   Software Engineer
  3716.    Language Products Group                     Symantec Corporation
  3717.            Internet: phils@cs.brandeis.edu
  3718. 
  3719. 
  3720. Path: ucivax!gateway
  3721. From: chuck@ksr.com
  3722. Subject: Segmentation bug -- maybe
  3723. Message-ID: <9205281419.AA11657@z8.ksr.com>
  3724. In-Reply-To: Kathleen Fischer's message of 27 May 92 20:14:42 GMT <01GKI9XBVCWW000X64@addvax.llnl.gov>
  3725. Newsgroups: fa.think-c
  3726. Lines: 69
  3727. Date: 28 May 92 14:18:52 GMT
  3728.  
  3729. > From: Kathleen Fischer <KFISCHER@arac.llnl.gov>
  3730. > X-Vms-To: ADDVAX::IN%"think-c@ics.uci.EDU"
  3731. > Date: 27 May 92 20:14:42 GMT
  3732. > X-Envelope-To: think-c@ics.uci.EDU
  3733. >
  3734. > >Of course, I use memcpy() and not a simple for loop because I want speed,
  3735. > >so it does not make sense to me to lock the handle before memcpy() and
  3736. > >unlock it afterwards.  I think that my solution -- to cause the ANSI
  3737. > >segment to load before I first use it -- is the right one.
  3738. >
  3739. > Ok -- I was following this discussion just fine (for a beginner) until the
  3740. > reference above to _speed_.  Why would locking/unlocking a handle be slow?
  3741. > Does the memory manager try to compact the space first?  I would think
  3742. > that locking/unlocking would be much safer than calling the ANSI segment
  3743. > first.
  3744. >
  3745. > Kathleen
  3746. >
  3747.  
  3748. My guess is the locking/unlocking is done efficiently and does not take too
  3749. much time.
  3750.  
  3751.  
  3752. I would like to take back some of what I said about speed, though.  Jamie
  3753. R. McCarthy wrote what I thought was a very true statement:
  3754.  
  3755.   > How much memory are you copying?  If it's more than a few hundred bytes,
  3756.   > the copy will take much longer than the locking/unlocking will.  If it's
  3757.   > not, don't worry about speed!  :-)
  3758.  
  3759. There are three issues here:
  3760.  
  3761.   * Speed: If the speed of a given program segment is important, there are
  3762.     many ways to optimize it (read the last Develop for an excellent
  3763.     description of speeding up a bitmap manipulating code).  Generally (but
  3764.     not necessarily), the more optimized a code is, the uglier it gets, and
  3765.     also less safe, which brings up the second issue:
  3766.  
  3767.   * Safety: programs should be not only "correct", but also safe.  One
  3768.     should program using lots of sanity checks (use ASSERT()), not only
  3769.     because it helps debug the program, but also because it helps maintain
  3770.     it in future revisions.  In our case, safety requires locking before
  3771.     and unlocking after: although you THINK that a given pointer is safe,
  3772.     you may be wrong.  I was wrong, as you know.
  3773.  
  3774.   * Ease of programming: some of us programmers try to make the program
  3775.     shorter and cleaner for no good reason other then our laziness (and
  3776.     some would say, a sense of esthetics).  "Short and clean" also means
  3777.     that someone else can dive into the code faster.  That someone else may
  3778.     be you, 6 months older.
  3779.  
  3780. The reason I used memcpy() was the third.  Memcpy() simply has that concise
  3781. touch to it, even more then a for loop.
  3782.  
  3783. The reason I refuse to lock my handles before calling memcpy() is that it
  3784. feels stupid IMHO to enclose every call to every ANSI procedure with
  3785. lock/unclock just because the very first time ANSI is loaded, memory moves
  3786. under you.  Lock/unclock requires to make the elegant memcpy() call a five
  3787. statement monster.  Since I now understand, thanks to the think-c netters,
  3788. what I did wrong, and since I understand how to make sure ANSI is loaded
  3789. before I first use it, I see no reason to lock.
  3790.  
  3791. If someone from Symantec is listening: could you guys come up with an easy
  3792. interface to mark a segment code resource as preloaded?  I was thinking
  3793. about a toggle much like toggling the debug flag of a module.  In the era
  3794. of Megabyte = $30, I would not mind if all the segments are preloaded by
  3795. default.
  3796.  
  3797. Chuck Shavit
  3798. 
  3799. 
  3800. Path: ucivax!gateway
  3801. From: potts@itl.itd.umich.edu (Paul Potts)
  3802. Subject: double posting
  3803. Message-ID: <9205281515.AA01349@itl.itd.umich.edu>
  3804. Newsgroups: fa.think-c
  3805. Lines: 3
  3806. Date: 28 May 92 15:16:00 GMT
  3807.  
  3808. Apologies for the double posting. I got a bounce message the first time
  3809. and reposted, but apparently it went through despite the bounce message.
  3810. -Paul-
  3811. 
  3812. 
  3813. Path: ucivax!gateway
  3814. From: SLC@harvarda.harvard.edu (Steven Cantor)
  3815. Subject: Re: Segmentation bug -- maybe
  3816. Message-ID: <9205280926.aa14899@q2.ics.uci.edu>
  3817. In-Reply-To: Your message of 28 May 92 13:19:17 GMT
  3818. Newsgroups: fa.think-c
  3819. Organization: Harvard University
  3820. X-Acknowledge-To: <SLC@HARVARDA>
  3821. Lines: 14
  3822. Date: 28 May 92 16:26:28 GMT
  3823.  
  3824. On 28 May 92 13:19:17 GMT Phil Shapiro said:
  3825. >A great (although getting on in years) book on this topic is Scott
  3826. >Knaster's "How to Write Macintosh Software".
  3827. >
  3828.   isn't a new edition of this book imminent?
  3829.   s.
  3830.  
  3831. -------------------------------------------------------------------------
  3832. Steven Cantor
  3833. Information Resources and Services  INTERNET:SLC@HARVARDA.HARVARD.EDU
  3834. Harvard University                  BITNET:  SLC@HARVARDA.BITNET
  3835.  _________                                                 ____________
  3836.           the wild geese do not intend to cast their shadow
  3837.           the water has no mind to receive their image
  3838. 
  3839. 
  3840. Path: ucivax!gateway
  3841. From: nagel@cigna.uucp
  3842. Subject: Re: double posting
  3843. Message-ID: <9205281651.AA25570@orwell>
  3844. Newsgroups: fa.think-c
  3845. Reply-To: think-c-request@ics.uci.edu
  3846. Lines: 19
  3847. Date: 28 May 92 17:07:51 GMT
  3848. References: <9205281515.AA01349@itl.itd.umich.edu>
  3849.  
  3850. In mail.think-c, Paul Potts <potts@itl.itd.umich.edu> writes:
  3851.  
  3852. >Apologies for the double posting. I got a bounce message the first time
  3853. >and reposted, but apparently it went through despite the bounce message.
  3854.  
  3855. People who mail to think-c should never see bounces due to
  3856. undeliverable mail to other list members.  Unfortunately, some sites
  3857. have broken mailers that ignore the message envelope and instead
  3858. send errors to the person mentioned in the 'From:' line.  This is
  3859. completely erroneous behavior.  I will not keep such addresses in
  3860. the list.  If you do get such a bounce, please send the complete
  3861. bounced message with errors and all to think-c-request@ics.uci.edu.
  3862. I will ZOT the addresses ASAP.
  3863.  
  3864. Mark
  3865. --
  3866. Mark Nagel <nagel@cigna.com>    | DISCLAIMER: If you had all of CIGNA's
  3867. Network Administrator        | in a container, you would not find mine
  3868. CIGNA/FIRST            | in that container.
  3869. 
  3870. 
  3871. Path: ucivax!gateway
  3872. From: potts@itl.itd.umich.edu (Paul Potts)
  3873. Subject: Re: double posting
  3874. Message-ID: <9205281957.AA02147@itl.itd.umich.edu>
  3875. Newsgroups: fa.think-c
  3876. Lines: 14
  3877. Date: 28 May 92 19:58:52 GMT
  3878.  
  3879.  
  3880. We should really kill this subject to stop wasting everyone's time, but I
  3881. thought I should mention that I found the problem... it was a typo on my
  3882. part. I typed "mail mail think-c@ic.uci.edu." The mail program immediately
  3883. generated a bounce message from my own host. I thought I must have made a
  3884. typo in the address "think-c@ic.uci.edu" so I sent the message again. What
  3885. actually happened, as you can guess, is that the mail program gagged on
  3886. mailing to "mail," bounced the message back to me, but sent it correctly
  3887. to the second recipient (think-c@ic.uci.edu). That's what I get for looking
  3888. away from the screen for a minute in the middle of typing a command. So,
  3889. it isn't anyone else's mailer or mine that is broken, it's my brain.
  3890.  
  3891. Sorry for the wasted bandwidth (and everybody's disk space...)
  3892. -Paul-
  3893. 
  3894. 
  3895. Path: ucivax!gateway
  3896. From: abboud@cedrus.cedrus.com ("Hisham A. Abboud")
  3897. Subject: summer jobs
  3898. Message-ID: <9205281933.AA02804@cedrus.com>
  3899. Newsgroups: fa.think-c
  3900. Lines: 14
  3901. Date: 28 May 92 21:12:43 GMT
  3902.  
  3903.  
  3904. I am looking for a sophomore/junior student to work for this summer (and
  3905. possibly part time in the fall) to do Mac programming using Think C.
  3906. Anyone interested or know someone interested?  Cedrus is located in
  3907. Columbia, Maryland.  Please e-mail me or call at (301) 589 1828.
  3908.  
  3909. Thanks!
  3910.  
  3911.                         Hisham.
  3912.  
  3913.  
  3914. Hisham A. Abboud, Cedrus Corp.  [Internet: abboud@cedrus.com]
  3915.  
  3916.  
  3917. 
  3918. 
  3919. Path: ucivax!gateway
  3920. From: king@acpub.duke.edu (King Rhoton)
  3921. Subject: Re:  summer jobs
  3922. Message-ID: <9205290257.AA07917@raphael.acpub.duke.edu>
  3923. Newsgroups: fa.think-c
  3924. Lines: 1
  3925. Date: 29 May 92 02:57:20 GMT
  3926.  
  3927.  
  3928. 
  3929. 
  3930. Path: ucivax!gateway
  3931. From: bobm@imagine.convex.com (Bob Miller)
  3932. Subject: More HLock/memcpy fu
  3933. Message-ID: <9205290434.AA22827@Mr_Grape.convex.com>
  3934. Newsgroups: fa.think-c
  3935. Lines: 144
  3936. Date: 29 May 92 04:35:19 GMT
  3937.  
  3938. Isn't this horse dead yet?
  3939.  
  3940. I was curious about how fast/slow HLock(), HUnlock() and memcpy()
  3941. really are, so I wrote a program to measure them.  Good time to learn
  3942. something about the Time Manager.  (Hey, it's a great manager!  A
  3943. nominee for Best-Implemented Low Level Feature.)
  3944.  
  3945. Anyway, I wrote a program, and I ran it on my IIsi (sans accelerators :-( ).
  3946. Here are the timings.
  3947.  
  3948. (Yow!  I just ran this stuff again while ZTerm is running, and everything
  3949. is half as fast!  The following numbers are while ZTerm is off.)
  3950.  
  3951.  
  3952. 128 microseconds to HLock/HUnlock.
  3953.     16-byte memcpy: 0.964587 megabytes/second
  3954.     32-byte memcpy: 1.11438 megabytes/second
  3955.     64-byte memcpy: 1.1915 megabytes/second
  3956.    128-byte memcpy: 1.24224 megabytes/second
  3957.    256-byte memcpy: 1.22066 megabytes/second
  3958.    512-byte memcpy: 1.23797 megabytes/second
  3959.   1024-byte memcpy: 1.24663 megabytes/second
  3960.   2048-byte memcpy: 1.25081 megabytes/second
  3961.   4096-byte memcpy: 1.25291 megabytes/second
  3962.   8192-byte memcpy: 1.25345 megabytes/second
  3963.  16384-byte memcpy: 1.25279 megabytes/second
  3964.  32768-byte memcpy: 1.25375 megabytes/second
  3965.  65536-byte memcpy: 1.25419 megabytes/second
  3966. 131072-byte memcpy: 1.26857 megabytes/second
  3967. 262144-byte memcpy: 1.17805 megabytes/second
  3968.  
  3969.                     K<bob>
  3970.  
  3971. (Compiled as application with 1000K partition, global optimization off)
  3972. ------------------------------------------------------------------------------
  3973. #include <stdio.h>
  3974. #include <string.h>
  3975.  
  3976. #define REPEAT_COUNT 10000L
  3977. #define MIN_BLOCK_SIZE 16
  3978. #define MAX_BLOCK_SIZE (256 * 1024L)    /* 256 Kb */
  3979. #define TOTAL_COPY (4 * 1048576L)    /*   4 Mb */
  3980. TMTask task;
  3981.  
  3982. static void start_timer(void)        /* Start measuring elapsed time. */
  3983. {
  3984.     task.qLink = nil;
  3985.     task.qType = 0;
  3986.     task.tmAddr = 0;
  3987.     task.tmCount = 0;
  3988.     InsTime(&task);
  3989.     PrimeTime(&task, 0x80000000);
  3990.  
  3991. }
  3992.  
  3993. static long stop_timer(void)        /* Stop measuring elapsed time. */
  3994. {
  3995.     RmvTime(&task);
  3996.     return task.tmCount - 0x80000000;    /* return time elapsed. */
  3997. }
  3998.  
  3999. static void measure_locks(void)
  4000. {
  4001.     long gross, tare, net;        /* all in microseconds */
  4002.     Handle h = NewHandle(1);
  4003.     long i;
  4004.  
  4005.     /* Make sure relevant parts are resident. */
  4006.  
  4007.     HLock(h); HUnlock(h);
  4008.  
  4009.     /* Measure overhead. */
  4010.  
  4011.     start_timer();
  4012.     for (i = 0; i < REPEAT_COUNT; i++)
  4013.         ;
  4014.     tare = stop_timer();
  4015.  
  4016.     /* Measure lock/unlock time */
  4017.  
  4018.     start_timer();
  4019.     for (i = 0; i < REPEAT_COUNT; i++)
  4020.     {
  4021.         HLock(h);
  4022.         HUnlock(h);
  4023.     }
  4024.     gross = stop_timer();
  4025.  
  4026.     /* Print results. */
  4027.  
  4028.     net = gross - tare;
  4029.     printf("%ld microseconds to HLock/HUnlock.\n", net / REPEAT_COUNT);
  4030. }
  4031.  
  4032. static void measure_copy(void)
  4033. {
  4034.     long gross, tare, net;        /* all in microseconds */
  4035.     size_t block_size;
  4036.     long n_copies;
  4037.     long i;
  4038.     void *src, *dst;
  4039.  
  4040.     for (block_size = MIN_BLOCK_SIZE; block_size <= MAX_BLOCK_SIZE; block_size <<= 1)
  4041.     {
  4042.         n_copies = TOTAL_COPY / block_size;
  4043.         src = NewPtr(block_size);
  4044.         dst = NewPtr(block_size);
  4045.  
  4046.         /* Touch every page of src and dst to make sure they're resident. */
  4047.  
  4048.         for (i = 0; i < block_size; i += 1000)
  4049.             ((char *) dst)[i] = ((char *) src)[i];
  4050.  
  4051.         /* Measure overhead. */
  4052.  
  4053.         start_timer();
  4054.         for (i = 0; i < n_copies; i++)
  4055.             ;
  4056.         tare = stop_timer();
  4057.  
  4058.         /* Measure copying time. */
  4059.  
  4060.         start_timer();
  4061.         for (i = 0; i < n_copies; i++)
  4062.             memcpy(dst, src, block_size);
  4063.         gross = stop_timer();
  4064.  
  4065.         /* Free memory and print results. */
  4066.  
  4067.         DisposePtr(src);
  4068.         DisposePtr(dst);
  4069.         net = gross - tare;
  4070.         printf("%6ld-byte memcpy: %g megabytes/second\n", block_size,
  4071.                TOTAL_COPY / 1048576 / ((float) net / 1000000));
  4072.     }
  4073. }
  4074.  
  4075. main()
  4076. {
  4077.     measure_locks();
  4078.     measure_copy();
  4079. }
  4080.  
  4081.  
  4082. 
  4083. 
  4084. Path: ucivax!gateway
  4085. From: s029@brems.ii.uib.no (Paul Franklin)
  4086. Subject: Re: MacBinary Source
  4087. Message-ID: <15776.9205301014@brems.ii.uib.no>
  4088. In-Reply-To: Your message of 27 May 92 22:27:18 +0000.
  4089.              <920527182434.20206372@vax.cs.hscsyr.edu>
  4090. Newsgroups: fa.think-c
  4091. Lines: 12
  4092. Date: 30 May 92 10:14:44 GMT
  4093.  
  4094. Your message dated: 27 May 92 22:27:18 GMT
  4095. >I'm writing a BBS host package, and I need some routines to do some MacBinary
  4096. >conversions. I have looked in all of the sources I know of, and if anyone could
  4097. >help point me to some Think C-compilable code, I would be greatful.
  4098. >
  4099. Look on sumex for a variety of files for converting MacBinary stuff, in the
  4100. unix dir.  They aren't Think-C, but as long as you replace the calls
  4101. to file open/read/write/close, they will probably do the work quite nicely.
  4102. And, since they have to work under lots of unix versions, they should
  4103. work on Mac's since they need to be byte sixe/order independent.
  4104.  
  4105. --Paul Franklin (pdfranklin@ucdavis.edu)
  4106. 
  4107. 
  4108. Path: ucivax!gateway
  4109. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  4110. Subject: Opening source files without following the path
  4111. Message-ID: <9205301435.AA03075@hobbes.kzoo.edu>
  4112. X-Mailer: ELM [version 2.3 PL11]
  4113. Newsgroups: fa.think-c
  4114. Lines: 19
  4115. Date: 30 May 92 14:33:21 GMT
  4116.  
  4117. I just, for the umpteenth time, did something I suspect a lot of other
  4118. people do:  when I want to open a source/header file quickly, I create a
  4119. new document, type in the file's name, select it, and do cmd-D for "Open
  4120. Selection".  (That is the standard key, right?  I've put a lot of
  4121. command keys in.)
  4122.  
  4123. For some reason, it suddenly occurred to me that it would be nice to
  4124. have a separate menu item for "Open... And Let ThC Search The Directory
  4125. Trees For You," instead of having to go through the five extra steps.
  4126. Just hit cmd-something, it brings up a dialog, type in the name, hit
  4127. return, it puts away the box, and brings up the file for you.
  4128.  
  4129. Someone please put this in the next version, right underneath "Open
  4130. Selection."  You'll make me very happy.
  4131. --
  4132.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  4133.  "A common way to answer a question about C is to 'see what the compiler
  4134.   does.'  Clearly C has suffered from being partly defined, then
  4135.   implemented."  - High C language reference manual, 1987
  4136. 
  4137. 
  4138. Path: ucivax!gateway
  4139. From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
  4140. Subject: Thanks. :)
  4141. Message-ID: <920530203712.2320717b@AZCC.Arizona.EDU>
  4142. Newsgroups: fa.think-c
  4143. Lines: 3
  4144. Date: 31 May 92 03:37:22 GMT
  4145. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  4146.  
  4147. Thanks to all that explained what the 32k segementation was all about.
  4148.  
  4149. Mike
  4150. 
  4151. 
  4152. Path: ucivax!gateway
  4153. From: petrus@alex.stacken.kth.se (Lars Petrus)
  4154. Subject: Search File & Open
  4155. Message-ID: <9205311133.AAalex.stacken.kth.se15514@alex.stacken.kth.se>
  4156. Newsgroups: fa.think-c
  4157. Lines: 19
  4158. Date: 31 May 92 11:34:03 GMT
  4159.  
  4160.  Jamie McCarthy     Internet: k044477Ikzoo.edu     AppleLink: j.mccarthy
  4161. >For some reason, it suddenly occurred to me that it would be nice to
  4162. >have a separate menu item for "Open... And Let ThC Search The Directory
  4163. >Trees For You," instead of having to go through the five extra steps.
  4164. >Just hit cmd-something, it brings up a dialog, type in the name, hit
  4165. >return, it puts away the box, and brings up the file for you.
  4166. >
  4167. >Someone please put this in the next version, right underneath "Open
  4168. >Selection."  You'll make me very happy.
  4169.  
  4170.    Nice idea, but I think it would be much better if this function
  4171. appeared when "Open Selection" is chosen *without* a selection! This means
  4172. that it will still be cmd-D (there are no free cmd keys anyway), and that
  4173. there won't be one more ugly and confusing menu item.
  4174.    To be real cute, the menu item should change to "Search File & Open..."
  4175. when there is no selection.
  4176.  
  4177. "Madness is the first sign of dandruff" |   Email:   petrus@alex.stacken.kth.se
  4178.    - Dr Winston O'Boogie                |   Reality: Lars Petrus, Solna, Sweden
  4179. 
  4180. 
  4181. Path: ucivax!gateway
  4182. From: odell@bu-it.bu.edu (Jim O'Dell)
  4183. Subject: Opening source files without following the path
  4184. Message-ID: <9205311449.AA10616@buitc.bu.edu>
  4185. In-Reply-To: "Jamie R. McCarthy"'s message of 30 May 92 14:33:21 GMT <9205301435.AA03075@hobbes.kzoo.edu>
  4186. Newsgroups: fa.think-c
  4187. Lines: 23
  4188. Date: 31 May 92 14:50:12 GMT
  4189.  
  4190.  
  4191. I just, for the umpteenth time, did something I suspect a lot of other
  4192. people do:  when I want to open a source/header file quickly, I create a
  4193. new document, type in the file's name, select it, and do cmd-D for "Open
  4194. Selection".  (That is the standard key, right?  I've put a lot of
  4195. command keys in.)
  4196.  
  4197. For some reason, it suddenly occurred to me that it would be nice to
  4198. have a separate menu item for "Open... And Let ThC Search The Directory
  4199. Trees For You," instead of having to go through the five extra steps.
  4200. Just hit cmd-something, it brings up a dialog, type in the name, hit
  4201. return, it puts away the box, and brings up the file for you.
  4202.  
  4203. Someone please put this in the next version, right underneath "Open
  4204. Selection."  You'll make me very happy.
  4205. -----------------
  4206. Also, how about being able to select an item that has been #defined in
  4207. some include file and have think C be able to look it up. I'd love that
  4208. feature also.
  4209.  
  4210. Jim
  4211.  
  4212.  
  4213. 
  4214.